use of net.geforcemods.securitycraft.tileentity.TileEntityKeypadChest in project SecurityCraft by Geforce132.
the class BlockKeypadChest method onNeighborBlockChange.
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor Block
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5Block) {
if (!(par1World.getTileEntity(par2, par3, par4) instanceof TileEntityKeypadChest))
return;
super.onNeighborBlockChange(par1World, par2, par3, par4, par5Block);
TileEntityKeypadChest tileentitychest = (TileEntityKeypadChest) par1World.getTileEntity(par2, par3, par4);
if (tileentitychest != null) {
tileentitychest.updateContainingBlockInfo();
}
}
use of net.geforcemods.securitycraft.tileentity.TileEntityKeypadChest in project SecurityCraft by Geforce132.
the class BlockUtils method setBlockProperty.
public static void setBlockProperty(World par1World, BlockPos pos, PropertyBool property, boolean value, boolean retainOldTileEntity) {
if (retainOldTileEntity) {
ItemStack[] modules = null;
ItemStack[] inventory = null;
int[] times = new int[4];
String password = "";
Owner owner = null;
int cooldown = -1;
if (par1World.getTileEntity(pos) instanceof CustomizableSCTE) {
modules = ((CustomizableSCTE) par1World.getTileEntity(pos)).itemStacks;
}
if (par1World.getTileEntity(pos) instanceof TileEntityKeypadFurnace) {
inventory = ((TileEntityKeypadFurnace) par1World.getTileEntity(pos)).furnaceItemStacks;
times[0] = ((TileEntityKeypadFurnace) par1World.getTileEntity(pos)).furnaceBurnTime;
times[1] = ((TileEntityKeypadFurnace) par1World.getTileEntity(pos)).currentItemBurnTime;
times[2] = ((TileEntityKeypadFurnace) par1World.getTileEntity(pos)).cookTime;
times[3] = ((TileEntityKeypadFurnace) par1World.getTileEntity(pos)).totalCookTime;
}
if (par1World.getTileEntity(pos) instanceof TileEntityOwnable && ((TileEntityOwnable) par1World.getTileEntity(pos)).getOwner() != null) {
owner = ((TileEntityOwnable) par1World.getTileEntity(pos)).getOwner();
}
if (par1World.getTileEntity(pos) instanceof TileEntityKeypad && ((TileEntityKeypad) par1World.getTileEntity(pos)).getPassword() != null) {
password = ((TileEntityKeypad) par1World.getTileEntity(pos)).getPassword();
}
if (par1World.getTileEntity(pos) instanceof TileEntityKeypadFurnace && ((TileEntityKeypadFurnace) par1World.getTileEntity(pos)).getPassword() != null) {
password = ((TileEntityKeypadFurnace) par1World.getTileEntity(pos)).getPassword();
}
if (par1World.getTileEntity(pos) instanceof TileEntityKeypadChest && ((TileEntityKeypadChest) par1World.getTileEntity(pos)).getPassword() != null) {
password = ((TileEntityKeypadChest) par1World.getTileEntity(pos)).getPassword();
}
if (par1World.getTileEntity(pos) instanceof TileEntityPortableRadar && ((TileEntityPortableRadar) par1World.getTileEntity(pos)).getAttackCooldown() != 0) {
cooldown = ((TileEntityPortableRadar) par1World.getTileEntity(pos)).getAttackCooldown();
}
TileEntity tileEntity = par1World.getTileEntity(pos);
par1World.setBlockState(pos, par1World.getBlockState(pos).withProperty(property, value));
par1World.setTileEntity(pos, tileEntity);
if (modules != null) {
((CustomizableSCTE) par1World.getTileEntity(pos)).itemStacks = modules;
}
if (inventory != null && par1World.getTileEntity(pos) instanceof TileEntityKeypadFurnace) {
((TileEntityKeypadFurnace) par1World.getTileEntity(pos)).furnaceItemStacks = inventory;
((TileEntityKeypadFurnace) par1World.getTileEntity(pos)).furnaceBurnTime = times[0];
((TileEntityKeypadFurnace) par1World.getTileEntity(pos)).currentItemBurnTime = times[1];
((TileEntityKeypadFurnace) par1World.getTileEntity(pos)).cookTime = times[2];
((TileEntityKeypadFurnace) par1World.getTileEntity(pos)).totalCookTime = times[3];
}
if (owner != null) {
((TileEntityOwnable) par1World.getTileEntity(pos)).getOwner().set(owner);
}
if (!password.isEmpty() && par1World.getTileEntity(pos) instanceof TileEntityKeypad) {
((TileEntityKeypad) par1World.getTileEntity(pos)).setPassword(password);
}
if (!password.isEmpty() && par1World.getTileEntity(pos) instanceof TileEntityKeypadFurnace) {
((TileEntityKeypadFurnace) par1World.getTileEntity(pos)).setPassword(password);
}
if (!password.isEmpty() && par1World.getTileEntity(pos) instanceof TileEntityKeypadChest) {
((TileEntityKeypadChest) par1World.getTileEntity(pos)).setPassword(password);
}
if (cooldown != -1 && par1World.getTileEntity(pos) instanceof TileEntityPortableRadar) {
((TileEntityPortableRadar) par1World.getTileEntity(pos)).setAttackCooldown(cooldown);
}
} else {
par1World.setBlockState(pos, par1World.getBlockState(pos).withProperty(property, value));
}
}
use of net.geforcemods.securitycraft.tileentity.TileEntityKeypadChest in project SecurityCraft by Geforce132.
the class BlockKeypadChest method onNeighborBlockChange.
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor Block
*/
public void onNeighborBlockChange(World par1World, BlockPos pos, IBlockState state, Block par5Block) {
super.onNeighborBlockChange(par1World, pos, state, par5Block);
TileEntityKeypadChest tileentitychest = (TileEntityKeypadChest) par1World.getTileEntity(pos);
if (tileentitychest != null) {
tileentitychest.updateContainingBlockInfo();
}
}
use of net.geforcemods.securitycraft.tileentity.TileEntityKeypadChest in project SecurityCraft by Geforce132.
the class BlockKeypadChest method onNeighborChange.
@Override
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
super.onNeighborChange(world, pos, neighbor);
TileEntityKeypadChest tileentitychest = (TileEntityKeypadChest) world.getTileEntity(pos);
if (tileentitychest != null) {
tileentitychest.updateContainingBlockInfo();
}
}
Aggregations