public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) { GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if ((tTileEntity instanceof IGregTechTileEntity)) { IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity; Random tRandom = new Random(); mTemporaryTileEntity.set(tGregTechTileEntity); for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); i++) { ItemStack tItem = tGregTechTileEntity.getStackInSlot(i); if ((tItem != null) && (tItem.stackSize > 0) && (tGregTechTileEntity.isValidSlot(i))) { EntityItem tItemEntity = new EntityItem( aWorld, aX + tRandom.nextFloat() * 0.8F + 0.1F, aY + tRandom.nextFloat() * 0.8F + 0.1F, aZ + tRandom.nextFloat() * 0.8F + 0.1F, new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); if (tItem.hasTagCompound()) { tItemEntity .getEntityItem() .setTagCompound((NBTTagCompound) tItem.getTagCompound().copy()); } tItemEntity.motionX = (tRandom.nextGaussian() * 0.0500000007450581D); tItemEntity.motionY = (tRandom.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D); tItemEntity.motionZ = (tRandom.nextGaussian() * 0.0500000007450581D); aWorld.spawnEntityInWorld(tItemEntity); tItem.stackSize = 0; tGregTechTileEntity.setInventorySlotContents(i, null); } } } super.breakBlock(aWorld, aX, aY, aZ, par5, par6); aWorld.removeTileEntity(aX, aY, aZ); }
public void onBlockExploded(World aWorld, int aX, int aY, int aZ, Explosion aExplosion) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if ((tTileEntity instanceof BaseMetaTileEntity)) { ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); } super.onBlockExploded(aWorld, aX, aY, aZ, aExplosion); }
public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) { ((IGregTechTileEntity) tTileEntity).onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); return; } super.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); }
public void dropBlockAsItemWithChance( World aWorld, int aX, int aY, int aZ, int par5, float chance, int par7) { if (!aWorld.isRemote) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if ((tTileEntity != null) && (chance < 1.0F)) { if (((tTileEntity instanceof BaseMetaTileEntity)) && (GregTech_API.sMachineNonWrenchExplosions)) { ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion(); } } else { super.dropBlockAsItemWithChance(aWorld, aX, aY, aZ, par5, chance, par7); } } }
public void addCollisionBoxesToList( World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, Entity collider) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) { ((IGregTechTileEntity) tTileEntity) .addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); return; } super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); }
public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { super.onBlockAdded(aWorld, aX, aY, aZ); if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ); } }
public boolean onBlockEventReceived( World aWorld, int aX, int aY, int aZ, int aData1, int aData2) { super.onBlockEventReceived(aWorld, aX, aY, aZ, aData1, aData2); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); return tTileEntity != null ? tTileEntity.receiveClientEvent(aData1, aData2) : false; }