diff options
author | miozune <miozune@gmail.com> | 2023-06-30 09:23:45 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-30 09:23:45 +0900 |
commit | 5036c2adee48f43f1772c0574ba6627f44455615 (patch) | |
tree | 982f905c667f065fd830691ba12a2612bf8630ee /src/main/java/gtPlusPlus/xmod/gregtech/common/blocks | |
parent | 904c9429c742d7e9e84fdeb584fe4c4ed2625bcd (diff) | |
download | GT5-Unofficial-5036c2adee48f43f1772c0574ba6627f44455615.tar.gz GT5-Unofficial-5036c2adee48f43f1772c0574ba6627f44455615.tar.bz2 GT5-Unofficial-5036c2adee48f43f1772c0574ba6627f44455615.zip |
Remove Breaker Box (#683)
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common/blocks')
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java | 578 | ||||
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java | 278 |
2 files changed, 0 insertions, 856 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java deleted file mode 100644 index 732dfb2ae8..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java +++ /dev/null @@ -1,578 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; -import net.minecraft.util.StatCollector; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.interfaces.IDebugableBlock; -import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_Generic_Block; -import gregtech.api.metatileentity.BaseMetaPipeEntity; -import gregtech.api.metatileentity.BaseMetaTileEntity; -import gregtech.api.metatileentity.BaseTileEntity; -import gregtech.api.util.GT_Utility; -import gregtech.common.blocks.GT_Material_Machines; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; -import gtPlusPlus.xmod.gregtech.common.render.GTPP_Render_MachineBlock; - -public class GTPP_Block_Machines extends GT_Generic_Block implements IDebugableBlock, ITileEntityProvider { - - public static ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal<IGregTechTileEntity>(); - - public GTPP_Block_Machines() { - super(GTPP_Item_Machines.class, "gtpp.blockmachines", new GT_Material_Machines()); - GregTech_API.registerMachineBlock(this, -1); - this.setHardness(1.0F); - this.setResistance(10.0F); - this.setStepSound(soundTypeMetal); - this.setCreativeTab(GregTech_API.TAB_GREGTECH); - this.isBlockContainer = true; - } - - @Override - public String getHarvestTool(int aMeta) { - switch (aMeta / 4) { - case 0: - return "wrench"; - case 1: - return "wrench"; - case 2: - return "cutter"; - case 3: - return "axe"; - default: - return "wrench"; - } - } - - @Override - public int getHarvestLevel(int aMeta) { - return aMeta % 4; - } - - @Override - protected boolean canSilkHarvest() { - return false; - } - - @Override - public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof BaseTileEntity) { - ((BaseTileEntity) tTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ); - } - } - - @Override - 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); - } - } - - @Override - public String getUnlocalizedName() { - int tDamage = 0; - String aUnlocalName = (tDamage >= 0 && tDamage < GregTech_API.METATILEENTITIES.length) - ? (GregTech_API.METATILEENTITIES[tDamage] != null - ? ("gtpp.blockmachines.name" + "." + GregTech_API.METATILEENTITIES[tDamage].getMetaName()) - : ("gtpp.blockmachines.name")) - : ""; - - Logger.INFO("Unlocal Name: " + aUnlocalName); - return aUnlocalName; - } - - @Override - public String getLocalizedName() { - String aName = StatCollector.translateToLocal(this.getUnlocalizedName() + ".name");; - if (aName.toLowerCase().contains(".name")) { - aName = StatCollector.translateToLocal(getUnlocalizedName() + ".name"); - } - if (aName.toLowerCase().contains(".name")) { - aName = StatCollector.translateToLocal("gt.blockmachines" + ".name"); - } - if (aName.toLowerCase().contains(".name")) { - aName = "BAD"; - } - Logger.INFO("Name: " + aName); - return aName; - } - - @Override - public int getFlammability(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) { - return 0; - } - - @Override - public int getFireSpreadSpeed(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) { - return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 100 : 0; - } - - @Override - public int getRenderType() { - return GTPP_Render_MachineBlock.INSTANCE == null ? super.getRenderType() - : GTPP_Render_MachineBlock.INSTANCE.mRenderID; - } - - @Override - public boolean isFireSource(World aWorld, int aX, int aY, int aZ, ForgeDirection side) { - return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0; - } - - @Override - public boolean isFlammable(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) { - return GregTech_API.sMachineFlammable && aWorld.getBlockMetadata(aX, aY, aZ) == 0; - } - - @Override - public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess aWorld, int aX, int aY, int aZ) { - return false; - } - - @Override - public boolean canConnectRedstone(IBlockAccess var1, int var2, int var3, int var4, int var5) { - return true; - } - - @Override - public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) { - return false; - } - - @Override - public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) { - return false; - } - - @Override - public boolean hasTileEntity(int aMeta) { - return true; - } - - @Override - public boolean hasComparatorInputOverride() { - return true; - } - - @Override - public boolean renderAsNormalBlock() { - return false; - } - - @Override - public boolean canProvidePower() { - return true; - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public TileEntity createNewTileEntity(World aWorld, int aMeta) { - return this.createTileEntity(aWorld, aMeta); - } - - @Override - public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int ordinalSide) { - return BlockIcons.MACHINE_LV_SIDE.getIcon(); - } - - @Override - public IIcon getIcon(int ordinalSide, int aMeta) { - return BlockIcons.MACHINE_LV_SIDE.getIcon(); - } - - @Override - 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; - } - - @Override - 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); - } else { - super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); - } - } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity - && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null - ? ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) - : super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - } - - @Override - @SideOnly(Side.CLIENT) - public AxisAlignedBB getSelectedBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity - && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null - ? ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ) - : super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ); - } - - @Override - public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int aX, int aY, int aZ) { - TileEntity tTileEntity = blockAccess.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity - && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null) { - AxisAlignedBB bbb = ((IGregTechTileEntity) tTileEntity) - .getCollisionBoundingBoxFromPool(((IGregTechTileEntity) tTileEntity).getWorld(), 0, 0, 0); - this.minX = bbb.minX; - this.minY = bbb.minY; - this.minZ = bbb.minZ; - this.maxX = bbb.maxX; - this.maxY = bbb.maxY; - this.maxZ = bbb.maxZ; - } else { - super.setBlockBoundsBasedOnState(blockAccess, aX, aY, aZ); - } - } - - @Override - public void setBlockBoundsForItemRender() { - super.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } - - @Override - 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); - } else { - super.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister aIconRegister) {} - - @Override - public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { - return super.getBlockHardness(aWorld, aX, aY, aZ); - } - - @Override - public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof BaseMetaTileEntity && ((BaseMetaTileEntity) tTileEntity).privateAccess() - && !((BaseMetaTileEntity) tTileEntity).playerOwnsThis(aPlayer, true) ? -1.0F - : super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ); - } - - @Override - public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int ordinalSide, - float par1, float par2, float par3) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity == null) { - return false; - } else { - if (aPlayer.isSneaking()) { - ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); - if (tCurrentItem == null) { - return false; - } - - if (!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList) - && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) { - return false; - } - } - - return tTileEntity instanceof IGregTechTileEntity ? (((IGregTechTileEntity) tTileEntity).getTimer() < 50L - ? false - : (!aWorld.isRemote && !((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer) ? true - : ((IGregTechTileEntity) tTileEntity).onRightclick( - aPlayer, - ForgeDirection.getOrientation(ordinalSide), - par1, - par2, - par3))) - : false; - } - } - - @Override - public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - ((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer); - } - } - - @Override - public int getDamageValue(World aWorld, int aX, int aY, int aZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getMetaTileID() : 0; - } - - @Override - 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); - } - - @Override - 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; - XSTR tRandom = new XSTR(); - 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, - (double) ((float) aX + tRandom.nextFloat() * 0.8F + 0.1F), - (double) ((float) aY + tRandom.nextFloat() * 0.8F + 0.1F), - (double) ((float) 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, (ItemStack) null); - } - } - } - - super.breakBlock(aWorld, aX, aY, aZ, par5, par6); - aWorld.removeTileEntity(aX, aY, aZ); - } - - @Override - public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getDrops() - : (mTemporaryTileEntity.get() == null ? new ArrayList() - : ((IGregTechTileEntity) mTemporaryTileEntity.get()).getDrops()); - } - - @Override - public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int ordinalSide) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity - ? ((IGregTechTileEntity) tTileEntity).getComparatorValue(ForgeDirection.getOrientation(ordinalSide)) - : 0; - } - - @Override - public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int ordinalSide) { - if (ordinalSide >= 0 && ordinalSide <= 5) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity - ? ((IGregTechTileEntity) tTileEntity) - .getOutputRedstoneSignal(ForgeDirection.getOrientation(ordinalSide).getOpposite()) - : 0; - } else { - return 0; - } - } - - @Override - public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int ordinalSide) { - if (ordinalSide >= 0 && ordinalSide <= 5) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity - ? ((IGregTechTileEntity) tTileEntity) - .getStrongOutputRedstoneSignal(ForgeDirection.getOrientation(ordinalSide).getOpposite()) - : 0; - } else { - return 0; - } - } - - @Override - 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); - } - } - } - - @Override - public boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection side) { - if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) { - return true; - } else { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity != null) { - if (tTileEntity instanceof BaseMetaTileEntity) { - return true; - } - - if (tTileEntity instanceof BaseMetaPipeEntity - && (((BaseMetaPipeEntity) tTileEntity).mConnections & -64) != 0) { - return true; - } - - if (tTileEntity instanceof ICoverable && ((ICoverable) tTileEntity).getCoverIDAtSide(side) != 0) { - return true; - } - } - - return false; - } - } - - @Override - public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity == null ? 0 - : (tTileEntity instanceof IGregTechTileEntity ? ((IGregTechTileEntity) tTileEntity).getLightOpacity() - : (aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0)); - } - - @Override - public int getLightValue(IBlockAccess aWorld, int aX, int aY, int aZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof BaseMetaTileEntity ? ((BaseMetaTileEntity) tTileEntity).getLightValue() : 0; - } - - @Override - public TileEntity createTileEntity(World aWorld, int aMeta) { - return (TileEntity) (aMeta >= 4 ? Meta_GT_Proxy.constructBaseMetaTileEntity() - : Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower()); - } - - @Override - public float getExplosionResistance(Entity par1Entity, World aWorld, int aX, int aY, int aZ, double explosionX, - double explosionY, double explosionZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof IGregTechTileEntity - ? ((IGregTechTileEntity) tTileEntity).getBlastResistance(ForgeDirection.UNKNOWN) - : 10.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - for (int i = 0; i < 100; ++i) { - if (GregTech_API.METATILEENTITIES[(30400 + i)] != null) { - par3List.add(new ItemStack(par1, 1, i)); - } - } - } - - @Override - public void onBlockPlacedBy(World aWorld, int aX, int aY, int aZ, EntityLivingBase aPlayer, ItemStack aStack) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity != null) { - if (tTileEntity instanceof IGregTechTileEntity) { - IGregTechTileEntity var6 = (IGregTechTileEntity) tTileEntity; - if (aPlayer == null) { - var6.setFrontFacing(ForgeDirection.UP); - } else { - int var7 = MathHelper.floor_double((double) (aPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; - int var8 = Math.round(aPlayer.rotationPitch); - if (var8 >= 65 && var6.isValidFacing(ForgeDirection.UP)) { - var6.setFrontFacing(ForgeDirection.UP); - } else if (var8 <= -65 && var6.isValidFacing(ForgeDirection.DOWN)) { - var6.setFrontFacing(ForgeDirection.DOWN); - } else { - switch (var7) { - case 0: - var6.setFrontFacing(ForgeDirection.NORTH); - break; - case 1: - var6.setFrontFacing(ForgeDirection.EAST); - break; - case 2: - var6.setFrontFacing(ForgeDirection.SOUTH); - break; - case 3: - var6.setFrontFacing(ForgeDirection.WEST); - } - } - } - } - } - } - - @Override - public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) { - TileEntity tTileEntity = aPlayer.worldObj.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof BaseMetaTileEntity - ? ((BaseMetaTileEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel) - : (tTileEntity instanceof BaseMetaPipeEntity - ? ((BaseMetaPipeEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel) - : null); - } - - @Override - public boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity instanceof IGregTechTileEntity) { - if (((IGregTechTileEntity) tTileEntity).getColorization() == (byte) (~aColor & 15)) { - return false; - } else { - ((IGregTechTileEntity) tTileEntity).setColorization((byte) (~aColor & 15)); - return true; - } - } else { - return false; - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java deleted file mode 100644 index e0fc48aa45..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Item_Machines.java +++ /dev/null @@ -1,278 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_ItsNotMyFaultException; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; - -public class GTPP_Item_Machines extends ItemBlock { - - public GTPP_Item_Machines(Block par1) { - super(par1); - this.setMaxDamage(0); - this.setHasSubtypes(true); - this.setCreativeTab(GregTech_API.TAB_GREGTECH); - } - - @Override - @SuppressWarnings("unchecked") - public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean par4) { - try { - int e = this.getDamage(aStack) + 30400; // Add Offset - if (e <= 0 || e >= GregTech_API.METATILEENTITIES.length) { - return; - } - - if (GregTech_API.METATILEENTITIES[e] != null) { - - IGregTechTileEntity aNBT = GregTech_API.METATILEENTITIES[e].getBaseMetaTileEntity(); - - final long tVoltage = aNBT.getInputVoltage(); - byte tTier = (byte) ((byte) Math.max(1, GT_Utility.getTier(tVoltage))); - - /* - * if (aNBT.getDescription() != null) { int tAmount = 0; String[] arg7 = aNBT.getDescription(); int arg8 - * = arg7.length-1; if (arg7 != null && arg7.length > 0) { for (String t : arg7) { aList.add(t); } } - * else { aList.add("ERROR"); } for (int y = 0; y < arg8; y++) { String tDescription = arg7[y]; if - * (tDescription != null) { aList.add(tDescription+"|"+arg8); continue; } else { continue; } } } - */ - - if (aNBT.getEUCapacity() > 0L) { - - // Custom handling - if ((e - 30400) <= 100) { - - if ((e - 30400) <= 10) { - tTier -= 2; - aList.add(EnumChatFormatting.BOLD + "16" + " Fuse Slots" + EnumChatFormatting.GRAY); - aList.add( - "Per each fuse, you may insert " + EnumChatFormatting.YELLOW - + (GT_Values.V[tTier]) - + EnumChatFormatting.GRAY - + " EU/t"); - aList.add( - "However this " + EnumChatFormatting.ITALIC - + EnumChatFormatting.RED - + "MUST" - + EnumChatFormatting.GRAY - + " be in a single Amp"); - aList.add( - "This machine can accept upto a single amp of " - + GT_Values.VN[Math.min(tTier + 2, 12)] - + " as a result"); - aList.add( - GT_LanguageManager.addStringLocalization( - "TileEntity_Breaker_Loss", - "Breaker Loss: " + EnumChatFormatting.RED - + "" - + (GT_Values.V[Math.max(tTier - 1, 0)] / 10) - + EnumChatFormatting.GRAY - + " EU/t", - !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); - } - - aList.add( - GT_LanguageManager.addStringLocalization( - "TileEntity_Special_Power_1", - EnumChatFormatting.RED + "Special Power Handling, please read manual", - !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); - // aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_2", - // EnumChatFormatting.RED+"Special Power Handling, please read manual", - // !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); - // aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_3", - // EnumChatFormatting.RED+"Special Power Handling, please read manual", - // !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); - } - - if (aNBT.getInputVoltage() > 0L) { - String inA = "0"; - if (aNBT.getInputAmperage() >= 1L) { - inA = " at " + EnumChatFormatting.YELLOW - + aNBT.getInputAmperage() - + EnumChatFormatting.GRAY - + " Amps"; - } else { - inA = " at " + EnumChatFormatting.WHITE - + aNBT.getInputAmperage() - + EnumChatFormatting.GRAY - + " Amps"; - } - String a1 = "Voltage IN: " + EnumChatFormatting.GREEN - + aNBT.getInputVoltage() - + " (" - + GT_Values.VN[GT_Utility.getTier(aNBT.getInputVoltage())] - + ")" - + EnumChatFormatting.GRAY - + inA; - aList.add(a1); - } - - if (aNBT.getOutputVoltage() > 0L) { - String outA = "0"; - if (aNBT.getOutputAmperage() >= 1L) { - outA = " at " + EnumChatFormatting.YELLOW - + aNBT.getOutputAmperage() - + EnumChatFormatting.GRAY - + " Amps"; - } else { - outA = " at " + EnumChatFormatting.WHITE - + aNBT.getOutputAmperage() - + EnumChatFormatting.GRAY - + " Amps"; - } - String a1 = "Voltage OUT: " + EnumChatFormatting.GREEN - + aNBT.getOutputVoltage() - + " (" - + GT_Values.VN[GT_Utility.getTier(aNBT.getOutputVoltage())] - + ")" - + EnumChatFormatting.GRAY - + outA; - aList.add(a1); - } - - aList.add( - GT_LanguageManager.addStringLocalization( - "TileEntity_Lossess_EU", - "Transmission Loss: " + EnumChatFormatting.DARK_BLUE + "0", - !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); - - aList.add( - GT_LanguageManager.addStringLocalization( - "TileEntity_EUp_STORE2", - "Internal Capacity: ", - !GregTech_API.sPostloadFinished) + EnumChatFormatting.BLUE - + aNBT.getEUCapacity() - + EnumChatFormatting.GRAY - + " EU"); - } - } - - NBTTagCompound arg16 = aStack.getTagCompound(); - if (arg16 != null) { - if (arg16.getBoolean("mMuffler")) { - aList.add( - GT_LanguageManager.addStringLocalization( - "GT_TileEntity_MUFFLER", - "has Muffler Upgrade", - !GregTech_API.sPostloadFinished)); - } - - if (arg16.getBoolean("mSteamConverter")) { - aList.add( - GT_LanguageManager.addStringLocalization( - "GT_TileEntity_STEAMCONVERTER", - "has Steam Upgrade", - !GregTech_API.sPostloadFinished)); - } - - boolean arg17 = false; - byte arg18; - if ((arg18 = arg16.getByte("mSteamTanks")) > 0) { - aList.add( - arg18 + " " - + GT_LanguageManager.addStringLocalization( - "GT_TileEntity_STEAMTANKS", - "Steam Tank Upgrades", - !GregTech_API.sPostloadFinished)); - } - } - - aList.add(EnumChatFormatting.UNDERLINE + "Special GT++ Machine"); - - } catch (Throwable arg15) { - arg15.printStackTrace(GT_Log.err); - } - } - - @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, - float hitX, float hitY, float hitZ) { - return false; - } - - @Override - public String getUnlocalizedName(ItemStack aStack) { - short tDamage = (short) (this.getDamage(aStack) + 30400); // Add Offset; - return tDamage >= 0 && tDamage < GregTech_API.METATILEENTITIES.length - ? (GregTech_API.METATILEENTITIES[tDamage] != null - ? "gtpp.blockmachines" + "." + GregTech_API.METATILEENTITIES[tDamage].getMetaName() - : "") - : ""; - } - - @Override - public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - super.onCreated(aStack, aWorld, aPlayer); - short tDamage = (short) ((short) this.getDamage(aStack) + 30400); // Add Offset; - if (tDamage < 0 - || tDamage >= GregTech_API.METATILEENTITIES.length && GregTech_API.METATILEENTITIES[tDamage] != null) { - GregTech_API.METATILEENTITIES[tDamage].onCreated(aStack, aWorld, aPlayer); - } - } - - @Override - public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, - float hitX, float hitY, float hitZ, int aMeta) { - short tDamage = (short) ((short) this.getDamage(aStack) + 30400); // Add Offset; - if (tDamage > 0) { - if (GregTech_API.METATILEENTITIES[tDamage] == null) { - return false; - } - - byte tMetaData = 32; - // byte tMetaData = GregTech_API.METATILEENTITIES[tDamage].getTileEntityBaseType(); - Logger.INFO( - "Using Meta: " + tMetaData - + " for ID " - + tDamage - + " | " - + GregTech_API.METATILEENTITIES[tDamage].getInventoryName()); - if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tMetaData, 3)) { - return false; - } - - if (aWorld.getBlock(aX, aY, aZ) != this.field_150939_a) { - throw new GT_ItsNotMyFaultException( - "Failed to place Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don\'t report this Bug to me, I don\'t know how to fix it."); - } - - if (aWorld.getBlockMetadata(aX, aY, aZ) != tMetaData) { - throw new GT_ItsNotMyFaultException( - "Failed to set the MetaValue of the Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don\'t report this Bug to me, I don\'t know how to fix it."); - } - - IGregTechTileEntity tTileEntity = (IGregTechTileEntity) aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity != null) { - tTileEntity.setInitialValuesAsNBT(tTileEntity.isServerSide() ? aStack.getTagCompound() : null, tDamage); - if (aPlayer != null) { - tTileEntity.setOwnerName(aPlayer.getDisplayName()); - } - - tTileEntity.getMetaTileEntity().initDefaultModes(aStack.getTagCompound()); - } - } else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tDamage, 3)) { - return false; - } - - if (aWorld.getBlock(aX, aY, aZ) == this.field_150939_a) { - this.field_150939_a.onBlockPlacedBy(aWorld, aX, aY, aZ, aPlayer, aStack); - this.field_150939_a.onPostBlockPlaced(aWorld, aX, aY, aZ, tDamage); - } - - return true; - } -} |