Skip to content

Commit

Permalink
-Updated to v1.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Geforce132 committed Feb 14, 2015
1 parent bc4b125 commit 02d1e01
Show file tree
Hide file tree
Showing 43 changed files with 740 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, E
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
{
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

((TileEntityInventoryScanner) par1World.getTileEntity(par2, par3, par4)).setOwner(((EntityPlayer) par5EntityLivingBase).getGameProfile().getId().toString(), par5EntityLivingBase.getCommandSenderName());

if (l == 0)
Expand Down Expand Up @@ -185,19 +184,15 @@ else if(par1World.getBlockMetadata(par2, par3, par4) == 3 && par1World.getBlock(
}

public void breakBlock(World par1World, int par2, int par3, int par4, Block par5Block, int par6){
// if(par1World.getBlockMetadata(par2, par3, par4) == 4 && par1World.getBlock(par2 - 2, par3, par4) == mod_SecurityCraft.inventoryScanner && par1World.getBlock(par2 - 1, par3, par4) == mod_SecurityCraft.inventoryScannerField && par1World.getBlockMetadata(par2 - 2, par3, par4) == 5){
// HelpfulMethods.destroyBlock(par1World, par2 - 1, par3, par4, false);
//
// }else if(par1World.getBlockMetadata(par2, par3, par4) == 5 && par1World.getBlock(par2 + 2, par3, par4) == mod_SecurityCraft.inventoryScanner && par1World.getBlock(par2 + 1, par3, par4) == mod_SecurityCraft.inventoryScannerField && par1World.getBlockMetadata(par2 + 2, par3, par4) == 4){
// HelpfulMethods.destroyBlock(par1World, par2 + 1, par3, par4, false);
//
// }else if(par1World.getBlockMetadata(par2, par3, par4) == 2 && par1World.getBlock(par2, par3, par4 - 2) == mod_SecurityCraft.inventoryScanner && par1World.getBlock(par2, par3, par4 - 1) == mod_SecurityCraft.inventoryScannerField && par1World.getBlockMetadata(par2, par3, par4 - 2) == 3){
// HelpfulMethods.destroyBlock(par1World, par2, par3, par4 - 1, false);
//
// }else if(par1World.getBlockMetadata(par2, par3, par4) == 3 && par1World.getBlock(par2, par3, par4 + 2) == mod_SecurityCraft.inventoryScanner && par1World.getBlock(par2, par3, par4 + 1) == mod_SecurityCraft.inventoryScannerField && par1World.getBlockMetadata(par2, par3, par4 + 2) == 2){
// HelpfulMethods.destroyBlock(par1World, par2, par3, par4 + 1, false);
//
// }
if(par6 == 4 && par1World.getBlock(par2 - 2, par3, par4) == mod_SecurityCraft.inventoryScanner && par1World.getBlockMetadata(par2 - 2, par3, par4) == 5){
HelpfulMethods.insertModule(par1World, par2 - 2, par3, par4, null);
}else if(par6 == 5 && par1World.getBlock(par2 + 2, par3, par4) == mod_SecurityCraft.inventoryScanner && par1World.getBlockMetadata(par2 + 2, par3, par4) == 4){
HelpfulMethods.insertModule(par1World, par2 + 2, par3, par4, null);
}else if(par6 == 2 && par1World.getBlock(par2, par3, par4 - 2) == mod_SecurityCraft.inventoryScanner && par1World.getBlockMetadata(par2, par3, par4 - 2) == 3){
HelpfulMethods.insertModule(par1World, par2, par3, par4 - 2, null);
}else if(par6 == 3 && par1World.getBlock(par2, par3, par4 + 2) == mod_SecurityCraft.inventoryScanner && par1World.getBlockMetadata(par2, par3, par4 + 2) == 2){
HelpfulMethods.insertModule(par1World, par2, par3, par4 + 2, null);
}

for(int i = 0; i < ((TileEntityInventoryScanner) par1World.getTileEntity(par2, par3, par4)).getContents().length; i++){
if(((TileEntityInventoryScanner) par1World.getTileEntity(par2, par3, par4)).getContents()[i] != null){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ public void insertCard(World par1World, int par2, int par3, int par4, ItemStack
if(HelpfulMethods.checkForModule(par1World, par2, par3, par4, par6EntityPlayer, EnumCustomModules.WHITELIST) || HelpfulMethods.checkForModule(par1World, par2, par3, par4, par6EntityPlayer, EnumCustomModules.BLACKLIST)){ return; }

if(((TileEntityKeycardReader)par1World.getTileEntity(par2, par3, par4)).getPassLV() != 0 && (!((TileEntityKeycardReader)par1World.getTileEntity(par2, par3, par4)).doesRequireExactKeycard() && ((TileEntityKeycardReader)par1World.getTileEntity(par2, par3, par4)).getPassLV() <= ((ItemKeycardBase) par5ItemStack.getItem()).getKeycardLV(par5ItemStack) || ((TileEntityKeycardReader)par1World.getTileEntity(par2, par3, par4)).doesRequireExactKeycard() && ((TileEntityKeycardReader)par1World.getTileEntity(par2, par3, par4)).getPassLV() == ((ItemKeycardBase) par5ItemStack.getItem()).getKeycardLV(par5ItemStack))){
if(par5ItemStack.getItemDamage() == 3 && par5ItemStack.stackTagCompound != null && !par6EntityPlayer.capabilities.isCreativeMode){
par5ItemStack.stackTagCompound.setInteger("Uses", par5ItemStack.stackTagCompound.getInteger("Uses") - 1);

if(par5ItemStack.stackTagCompound.getInteger("Uses") <= 0){
par5ItemStack.stackSize--;
}
}

((TileEntityKeycardReader)par1World.getTileEntity(par2, par3, par4)).setIsProvidingPower(true);
new ScheduleKeycardUpdate(3, par1World, par2, par3, par4, meta);
par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.freeforums.geforce.securitycraft.blocks;

import java.lang.reflect.Field;

import net.minecraft.block.Block;
import net.minecraft.block.BlockChest;
import net.minecraft.block.material.Material;
Expand All @@ -21,15 +19,6 @@ public class BlockKeypadChest extends BlockChest{

public BlockKeypadChest(int par1){
super(par1);

Field material = ReflectionHelper.findField(Block.class, "blockMaterial");
try{
material.set(this, Material.iron);
}catch(IllegalArgumentException e){
e.printStackTrace();
}catch(IllegalAccessException e){
e.printStackTrace();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,14 @@ public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int p
for(int i = 1; i <= mod_SecurityCraft.configHandler.laserBlockRange; i++){
Block id = par1World.getBlock(par2 + i, par3, par4);
if(id == mod_SecurityCraft.LaserBlock){
if(((CustomizableSCTE) par1World.getTileEntity(par2 + i, par3, par4)).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2 + i, par3, par4, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) par5Entity).getCommandSenderName())){ return; }
//par1World.setBlock(par2 + i, par3, par4, mod_SecurityCraft.LaserBlock, 2, 3); //TODO
if(par1World.getTileEntity(par2 + i, par3, par4) instanceof CustomizableSCTE && ((CustomizableSCTE) par1World.getTileEntity(par2 + i, par3, par4)).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2 + i, par3, par4, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) par5Entity).getCommandSenderName())){ return; }
par1World.setBlockMetadataWithNotify(par2 + i, par3, par4, 2, 3);
par1World.notifyBlocksOfNeighborChange(par2 + i, par3, par4, mod_SecurityCraft.LaserBlock);
par1World.scheduleBlockUpdate(par2 + i, par3, par4, mod_SecurityCraft.LaserBlock, 50);
par1World.notifyBlocksOfNeighborChange(par2 + i, par3, par4, mod_SecurityCraft.LaserBlock);

if(par1World.getTileEntity(par2 + i, par3, par4) instanceof CustomizableSCTE && ((CustomizableSCTE) par1World.getTileEntity(par2 + i, par3, par4)).hasModule(EnumCustomModules.HARMING)){
float f = ((EntityLivingBase) par5Entity).getHealth();
((EntityLivingBase) par5Entity).attackEntityFrom(DamageSource.generic, 10F);
//((EntityLivingBase) par5Entity).setHealth(f - 0.5F);
}
}else{
continue;
Expand All @@ -77,17 +74,14 @@ public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int p
for(int i = 0; i <= mod_SecurityCraft.configHandler.laserBlockRange; i++){
Block id = par1World.getBlock(par2 - i, par3, par4);
if(id == mod_SecurityCraft.LaserBlock){
if(((CustomizableSCTE) par1World.getTileEntity(par2 - i, par3, par4)).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2 - i, par3, par4, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) par5Entity).getCommandSenderName())){ return; }
//par1World.setBlock(par2 - i, par3, par4, mod_SecurityCraft.LaserBlock, 2, 3);
if(par1World.getTileEntity(par2 - i, par3, par4) instanceof CustomizableSCTE && ((CustomizableSCTE) par1World.getTileEntity(par2 - i, par3, par4)).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2 - i, par3, par4, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) par5Entity).getCommandSenderName())){ return; }
par1World.setBlockMetadataWithNotify(par2 - i, par3, par4, 2, 3);
par1World.notifyBlocksOfNeighborChange(par2 - i, par3, par4, mod_SecurityCraft.LaserBlock);
par1World.scheduleBlockUpdate(par2 - i, par3, par4, mod_SecurityCraft.LaserBlock, 50);
par1World.notifyBlocksOfNeighborChange(par2 - i, par3, par4, mod_SecurityCraft.LaserBlock);

if(par1World.getTileEntity(par2 - i, par3, par4) instanceof CustomizableSCTE && ((CustomizableSCTE) par1World.getTileEntity(par2 - i, par3, par4)).hasModule(EnumCustomModules.HARMING)){
float f = ((EntityLivingBase) par5Entity).getHealth();
((EntityLivingBase) par5Entity).attackEntityFrom(DamageSource.generic, 10F);
//((EntityLivingBase) par5Entity).setHealth(f - 0.5F);
}
}else{
continue;
Expand All @@ -97,16 +91,14 @@ public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int p
for(int i = 0; i <= mod_SecurityCraft.configHandler.laserBlockRange; i++){
Block id = par1World.getBlock(par2, par3, par4 + i);
if(id == mod_SecurityCraft.LaserBlock){
//par1World.setBlock(par2, par3, par4 + i, mod_SecurityCraft.LaserBlock, 2, 3);
if(par1World.getTileEntity(par2, par3, par4 + i) instanceof CustomizableSCTE && ((CustomizableSCTE) par1World.getTileEntity(par2, par3, par4 + i)).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4 + i, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) par5Entity).getCommandSenderName())){ return; }
par1World.setBlockMetadataWithNotify(par2, par3, par4 + i, 2, 3);
par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + i, mod_SecurityCraft.LaserBlock);
par1World.scheduleBlockUpdate(par2, par3, par4 + i, mod_SecurityCraft.LaserBlock, 50);
par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + i, mod_SecurityCraft.LaserBlock);

if(par1World.getTileEntity(par2, par3, par4 + i) instanceof CustomizableSCTE && ((CustomizableSCTE) par1World.getTileEntity(par2, par3, par4 + i)).hasModule(EnumCustomModules.HARMING)){
float f = ((EntityLivingBase) par5Entity).getHealth();
((EntityLivingBase) par5Entity).attackEntityFrom(DamageSource.generic, 10F);
//((EntityLivingBase) par5Entity).setHealth(f - 0.5F);
}
}else{
continue;
Expand All @@ -116,16 +108,14 @@ public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int p
for(int i = 0; i <= mod_SecurityCraft.configHandler.laserBlockRange; i++){
Block id = par1World.getBlock(par2, par3, par4 - i);
if(id == mod_SecurityCraft.LaserBlock){
//par1World.setBlock(par2, par3, par4 - i, mod_SecurityCraft.LaserBlock, 2, 3);
if(par1World.getTileEntity(par2, par3, par4 - i) instanceof CustomizableSCTE && ((CustomizableSCTE) par1World.getTileEntity(par2, par3, par4 - i)).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4 - i, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) par5Entity).getCommandSenderName())){ return; }
par1World.setBlockMetadataWithNotify(par2, par3, par4 - i, 2, 3);
par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - i, mod_SecurityCraft.LaserBlock);
par1World.scheduleBlockUpdate(par2, par3, par4 - i, mod_SecurityCraft.LaserBlock, 50);
par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - i, mod_SecurityCraft.LaserBlock);

if(par1World.getTileEntity(par2, par3, par4 - i) instanceof CustomizableSCTE && ((CustomizableSCTE) par1World.getTileEntity(par2, par3, par4 - i)).hasModule(EnumCustomModules.HARMING)){
float f = ((EntityLivingBase) par5Entity).getHealth();
((EntityLivingBase) par5Entity).attackEntityFrom(DamageSource.generic, 10F);
//((EntityLivingBase) par5Entity).setHealth(f - 0.5F);
}
}else{
continue;
Expand All @@ -135,16 +125,14 @@ public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int p
for(int i = 0; i <= mod_SecurityCraft.configHandler.laserBlockRange; i++){
Block id = par1World.getBlock(par2, par3 + i, par4);
if(id == mod_SecurityCraft.LaserBlock){
//par1World.setBlock(par2, par3 + i, par4, mod_SecurityCraft.LaserBlock, 2, 3);
if(par1World.getTileEntity(par2, par3 + i, par4 ) instanceof CustomizableSCTE && ((CustomizableSCTE) par1World.getTileEntity(par2, par3 + i, par4)).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3 + i, par4, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) par5Entity).getCommandSenderName())){ return; }
par1World.setBlockMetadataWithNotify(par2, par3 + i, par4 , 2, 3);
par1World.notifyBlocksOfNeighborChange(par2, par3 + i, par4, mod_SecurityCraft.LaserBlock);
par1World.scheduleBlockUpdate(par2, par3 + i, par4, mod_SecurityCraft.LaserBlock, 50);
par1World.notifyBlocksOfNeighborChange(par2, par3 + i, par4, mod_SecurityCraft.LaserBlock);

if(par1World.getTileEntity(par2, par3 + i, par4) instanceof CustomizableSCTE && ((CustomizableSCTE) par1World.getTileEntity(par2, par3 + i, par4)).hasModule(EnumCustomModules.HARMING)){
float f = ((EntityLivingBase) par5Entity).getHealth();
((EntityLivingBase) par5Entity).attackEntityFrom(DamageSource.generic, 10F);
//((EntityLivingBase) par5Entity).setHealth(f - 0.5F);
}
}else{
continue;
Expand All @@ -154,16 +142,14 @@ public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int p
for(int i = 0; i <= mod_SecurityCraft.configHandler.laserBlockRange; i++){
Block id = par1World.getBlock(par2, par3 - i, par4);
if(id == mod_SecurityCraft.LaserBlock){
//par1World.setBlock(par2, par3 - i, par4, mod_SecurityCraft.LaserBlock, 2, 3);
if(par1World.getTileEntity(par2, par3 - i, par4 ) instanceof CustomizableSCTE && ((CustomizableSCTE) par1World.getTileEntity(par2, par3 - i, par4)).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3 - i, par4, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) par5Entity).getCommandSenderName())){ return; }
par1World.setBlockMetadataWithNotify(par2, par3 - i, par4 , 2, 3);
par1World.notifyBlocksOfNeighborChange(par2, par3 - i, par4, mod_SecurityCraft.LaserBlock);
par1World.scheduleBlockUpdate(par2, par3 - i, par4, mod_SecurityCraft.LaserBlock, 50);
par1World.notifyBlocksOfNeighborChange(par2, par3 - i, par4, mod_SecurityCraft.LaserBlock);

if(par1World.getTileEntity(par2, par3 - i, par4) instanceof CustomizableSCTE && ((CustomizableSCTE) par1World.getTileEntity(par2, par3 - i, par4)).hasModule(EnumCustomModules.HARMING)){
float f = ((EntityLivingBase) par5Entity).getHealth();
((EntityLivingBase) par5Entity).attackEntityFrom(DamageSource.generic, 10F);
//((EntityLivingBase) par5Entity).setHealth(f - 0.5F);
}
}else{
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, E
if(par5EntityPlayer.getCurrentEquippedItem() == null || !isInteractibleItem(par5EntityPlayer.getCurrentEquippedItem().getItem())){
this.explode(par1World, par2, par3, par4);
return false;
}else if(par5EntityPlayer.getCurrentEquippedItem().getItem() == mod_SecurityCraft.wireCutters){
}else if(par5EntityPlayer.getCurrentEquippedItem().getItem() == mod_SecurityCraft.wireCutters && par1World.getBlock(par2, par3, par4) == mod_SecurityCraft.Mine){
par1World.setBlock(par2, par3, par4, mod_SecurityCraft.MineCut);
par5EntityPlayer.getCurrentEquippedItem().damageItem(1, par5EntityPlayer);
return true;
}else if(par5EntityPlayer.getCurrentEquippedItem().getItem() == Items.flint_and_steel){
}else if(par5EntityPlayer.getCurrentEquippedItem().getItem() == Items.flint_and_steel && par1World.getBlock(par2, par3, par4) == mod_SecurityCraft.MineCut){
par1World.setBlock(par2, par3, par4, mod_SecurityCraft.Mine);
return true;
}else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,33 @@ public void processCommand(ICommandSender par1ICommandSender, String[] par2Strin
player.getCurrentEquippedItem().stackTagCompound = new NBTTagCompound();
}

for(int i = 1; i <= 10; i++){
if(player.getCurrentEquippedItem().getTagCompound().hasKey("Player" + i) && player.getCurrentEquippedItem().getTagCompound().getString("Player" + i).matches(par2String[1])){
HelpfulMethods.sendMessageToPlayer(player, "The module you are holding already contains the player " + par2String[1] + ".", EnumChatFormatting.RED);
return;
}
}

player.getCurrentEquippedItem().stackTagCompound.setString("Player" + getNextSlot(player.getCurrentEquippedItem().stackTagCompound), par2String[1]);
return;
}else{
HelpfulMethods.sendMessageToPlayer(player, "You must be holding the module you wish to modify!", EnumChatFormatting.RED);
return;
}
}else if(par2String[0].matches("remove")){
EntityPlayer player = HelpfulMethods.getPlayerFromName(par1ICommandSender.getCommandSenderName());

if(player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemModule && ((ItemModule) player.getCurrentEquippedItem().getItem()).canBeModified()){
if(player.getCurrentEquippedItem().getTagCompound() == null){
player.getCurrentEquippedItem().setTagCompound(new NBTTagCompound());
}

for(int i = 1; i <= 10; i++){
if(player.getCurrentEquippedItem().getTagCompound().hasKey("Player" + i) && player.getCurrentEquippedItem().getTagCompound().getString("Player" + i).matches(par2String[1])){
player.getCurrentEquippedItem().getTagCompound().removeTag("Player" + i);
}
}

return;
}else{
HelpfulMethods.sendMessageToPlayer(player, "You must be holding the module you wish to modify!", EnumChatFormatting.RED);
Expand Down
Loading

0 comments on commit 02d1e01

Please sign in to comment.