use of net.geforcemods.securitycraft.tileentity.TileEntityInventoryScanner in project SecurityCraft by Geforce132.
the class Utils method setISinTEAppropriately.
public static void setISinTEAppropriately(World par1World, BlockPos pos, ItemStack[] contents, String type) {
TileEntityInventoryScanner connectedScanner = BlockInventoryScanner.getConnectedInventoryScanner(par1World, pos);
connectedScanner.setContents(contents);
connectedScanner.setType(type);
}
use of net.geforcemods.securitycraft.tileentity.TileEntityInventoryScanner in project SecurityCraft by Geforce132.
the class BlockInventoryScannerField method checkAndUpdateTEAppropriately.
private static void checkAndUpdateTEAppropriately(TileEntityInventoryScanner te) {
TileEntityInventoryScanner connectedScanner = BlockInventoryScanner.getConnectedInventoryScanner(te.getWorld(), te.getPos());
te.setShouldProvidePower(true);
te.setCooldown(60);
BlockUtils.updateAndNotify(te.getWorld(), te.getPos(), te.getBlockType(), 1, true);
connectedScanner.setShouldProvidePower(true);
connectedScanner.setCooldown(60);
BlockUtils.updateAndNotify(connectedScanner.getWorld(), connectedScanner.getPos(), connectedScanner.getBlockType(), 1, true);
}
use of net.geforcemods.securitycraft.tileentity.TileEntityInventoryScanner in project SecurityCraft by Geforce132.
the class Utils method setISinTEAppropriately.
public static void setISinTEAppropriately(World par1World, int par2, int par3, int par4, ItemStack[] contents, String type) {
TileEntityInventoryScanner connectedScanner = BlockInventoryScanner.getConnectedInventoryScanner(par1World, par2, par3, par4);
connectedScanner.setContents(contents);
connectedScanner.setType(type);
}
use of net.geforcemods.securitycraft.tileentity.TileEntityInventoryScanner in project SecurityCraft by Geforce132.
the class BlockInventoryScanner method breakBlock.
@Override
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5Block, int par6) {
if (par1World.isRemote)
return;
TileEntityInventoryScanner connectedScanner = null;
for (int i = 1; i <= SecurityCraft.config.inventoryScannerRange; i++) {
if (par1World.getBlock(par2 - i, par3, par4) == SCContent.inventoryScanner) {
for (int j = 1; j < i; j++) {
if (par1World.getBlock(par2 - j, par3, par4) == SCContent.inventoryScannerField)
par1World.breakBlock(par2 - j, par3, par4, false);
}
connectedScanner = (TileEntityInventoryScanner) par1World.getTileEntity(par2 - i, par3, par4);
break;
}
}
for (int i = 1; i <= SecurityCraft.config.inventoryScannerRange; i++) {
if (par1World.getBlock(par2 + i, par3, par4) == SCContent.inventoryScanner) {
for (int j = 1; j < i; j++) {
if (par1World.getBlock(par2 + j, par3, par4) == SCContent.inventoryScannerField)
par1World.breakBlock(par2 + j, par3, par4, false);
}
connectedScanner = (TileEntityInventoryScanner) par1World.getTileEntity(par2 + i, par3, par4);
break;
}
}
for (int i = 1; i <= SecurityCraft.config.inventoryScannerRange; i++) {
if (par1World.getBlock(par2, par3, par4 - i) == SCContent.inventoryScanner) {
for (int j = 1; j < i; j++) {
if (par1World.getBlock(par2, par3, par4 - j) == SCContent.inventoryScannerField)
par1World.breakBlock(par2, par3, par4 - j, false);
}
connectedScanner = (TileEntityInventoryScanner) par1World.getTileEntity(par2, par3, par4 - i);
break;
}
}
for (int i = 1; i <= SecurityCraft.config.inventoryScannerRange; i++) {
if (par1World.getBlock(par2, par3, par4 + i) == SCContent.inventoryScanner) {
for (int j = 1; j < i; j++) {
if (par1World.getBlock(par2, par3, par4 + j) == SCContent.inventoryScannerField)
par1World.breakBlock(par2, par3, par4 + j, false);
}
connectedScanner = (TileEntityInventoryScanner) par1World.getTileEntity(par2, par3, par4 + i);
break;
}
}
for (int i = 0; i < ((TileEntityInventoryScanner) par1World.getTileEntity(par2, par3, par4)).getContents().length; i++) {
if (((TileEntityInventoryScanner) par1World.getTileEntity(par2, par3, par4)).getContents()[i] != null)
par1World.spawnEntityInWorld(new EntityItem(par1World, par2, par3, par4, ((TileEntityInventoryScanner) par1World.getTileEntity(par2, par3, par4)).getContents()[i]));
}
if (connectedScanner != null) {
for (int i = 0; i < connectedScanner.getContents().length; i++) {
connectedScanner.getContents()[i] = null;
}
}
super.breakBlock(par1World, par2, par3, par4, par5Block, par6);
}
Aggregations