diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-10-21 06:08:51 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-10-21 06:08:51 +1000 |
commit | 77e7efe4f6ce3f6562c86569bbc831caa16ebf8d (patch) | |
tree | 363044e96429ecc4d3cb5065497ae16e6d75a578 /src/Java/gtPlusPlus/xmod/gregtech/common | |
parent | 47463aad337204f1821e873d8f93b625e9abc0dc (diff) | |
download | GT5-Unofficial-77e7efe4f6ce3f6562c86569bbc831caa16ebf8d.tar.gz GT5-Unofficial-77e7efe4f6ce3f6562c86569bbc831caa16ebf8d.tar.bz2 GT5-Unofficial-77e7efe4f6ce3f6562c86569bbc831caa16ebf8d.zip |
% Cleaned up tank tooltips.
- Removed all old code now not required by tanks.
- Removed the GT4 workbench classes, favourite my homebrew ones.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
6 files changed, 170 insertions, 1653 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index 98fcc6d6bb..3ef5af0774 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -11,7 +11,7 @@ import gregtech.api.enums.SubTag; import gregtech.api.enums.TC_Aspects; import gregtech.api.enums.ToolDictNames; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.metatileentity.BaseMetaTileEntityEx; +import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.objects.ItemData; import gregtech.api.objects.MaterialStack; import gregtech.api.util.GT_Log; @@ -914,17 +914,17 @@ public class Meta_GT_Proxy { /** * This gives you a new BaseMetaTileEntity. As some Interfaces are not always loaded (Buildcraft, Univeral Electricity) I have to use Invocation at the Constructor of the BaseMetaTileEntity */ - private static Class<BaseMetaTileEntityEx> sBaseMetaTileEntityClass = null; + private static Class<BaseMetaTileEntity> sBaseMetaTileEntityClass = null; - public static BaseMetaTileEntityEx constructBaseMetaTileEntity() { + public static BaseMetaTileEntity constructBaseMetaTileEntity() { if (sBaseMetaTileEntityClass == null) { try { - return (BaseMetaTileEntityEx) (sBaseMetaTileEntityClass = BaseMetaTileEntityEx.class).newInstance(); + return (BaseMetaTileEntity) (sBaseMetaTileEntityClass = BaseMetaTileEntity.class).newInstance(); } catch (Throwable e) {/*Do nothing*/} } try { - return (BaseMetaTileEntityEx) (sBaseMetaTileEntityClass.newInstance()); + return (BaseMetaTileEntity) (sBaseMetaTileEntityClass.newInstance()); } catch (Throwable e) { Utils.LOG_INFO("Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); e.printStackTrace(GT_Log.err); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechBlockMachines.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechBlockMachines.java deleted file mode 100644 index 0b47d3c5c1..0000000000 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechBlockMachines.java +++ /dev/null @@ -1,553 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.blocks; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IDebugableBlock; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -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.BaseMetaTileEntityEx; -import gregtech.api.metatileentity.BaseTileEntity; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Utility; -import gregtech.common.blocks.GT_Item_Machines; -import gregtech.common.blocks.GT_Material_Machines; -import gregtech.common.render.GT_Renderer_Block; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -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; - -public class GregtechBlockMachines - extends GT_Generic_Block - implements IDebugableBlock, ITileEntityProvider { - public static ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal<IGregTechTileEntity>(); - - public GregtechBlockMachines() { - super(GT_Item_Machines.class, "gt.plusplus.blockmachines", new GT_Material_Machines()); - GregTech_API.registerMachineBlock(this, -1); - setHardness(1.0F); - setResistance(10.0F); - setStepSound(soundTypeMetal); - setCreativeTab(AddToCreativeTab.tabMachines); - 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: - break; - } - 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() { - return "gt.plusplus.blockmachines"; - } - - @Override - public String getLocalizedName() { - return StatCollector.translateToLocal(getUnlocalizedName() + ".name"); - } - - @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() { - if (GT_Renderer_Block.INSTANCE == null) { - return super.getRenderType(); - } - return GT_Renderer_Block.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 createTileEntity(aWorld, aMeta); - } - - @Override - public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) { - return Textures.BlockIcons.MACHINE_LV_SIDE.getIcon(); - } - - @Override - public IIcon getIcon(int aSide, int aMeta) { - return Textures.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); - return; - } - 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); - if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) { - return ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - } - return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - } - - @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); - return; - } - super.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider); - } - - @Override //TODO - @SideOnly(Side.CLIENT) //TODO - public void registerBlockIcons(IIconRegister aIconRegister) { - if (GregTech_API.sPostloadFinished) { - Utils.LOG_INFO("Setting up Icon Register for Blocks"); - Meta_GT_Proxy.sBlockIcons = aIconRegister; - - Utils.LOG_INFO("Registering MetaTileEntity specific Textures"); - for (IMetaTileEntity tMetaTileEntity : Meta_GT_Proxy.METATILEENTITIES) { - try { - if (tMetaTileEntity != null) { - tMetaTileEntity.registerIcons(aIconRegister); - } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } - } - - Utils.LOG_INFO("Starting Block Icon Load Phase"); - System.out.println("Starting Block Icon Load Phase"); - for (Runnable tRunnable : Meta_GT_Proxy.GT_BlockIconload) { - try { - tRunnable.run(); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } - } - Utils.LOG_INFO("Finished Block Icon Load Phase"); - System.out.println("Finished Block Icon Load Phase"); - } - } - - @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); - if (((tTileEntity instanceof BaseMetaTileEntityEx)) && (((BaseMetaTileEntityEx) tTileEntity).privateAccess()) && (!((BaseMetaTileEntityEx) tTileEntity).playerOwnsThis(aPlayer, true))) { - return -1.0F; - } - return super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ); - } - - @Override - public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float par1, float par2, float par3) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity == null) { - return false; - } - if(aPlayer.isSneaking()){ - ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem(); - if(tCurrentItem!=null){ - if(!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)){ - return false; - } - }else {return false;} - } - if ((tTileEntity instanceof IGregTechTileEntity)) { - if (((IGregTechTileEntity) tTileEntity).getTimer() < 50L) { - return false; - } - if ((!aWorld.isRemote) && (!((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer))) { - return true; - } - return ((IGregTechTileEntity) tTileEntity).onRightclick(aPlayer, (byte) aSide, par1, par2, par3); - } - return false; - } - - @Override - public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && - ((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); - if ((tTileEntity instanceof IGregTechTileEntity)) { - return ((IGregTechTileEntity) tTileEntity).getMetaTileID(); - } - return 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 BaseMetaTileEntityEx)) { - ((BaseMetaTileEntityEx) 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; - 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); - } - - @Override - public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity instanceof IGregTechTileEntity)) { - return ((IGregTechTileEntity) tTileEntity).getDrops(); - } - return mTemporaryTileEntity.get() == null ? new ArrayList() : ((IGregTechTileEntity) mTemporaryTileEntity.get()).getDrops(); - } - - @Override - public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { - return ((IGregTechTileEntity) tTileEntity).getComparatorValue((byte) aSide); - } - return 0; - } - - @Override - public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { - if ((aSide < 0) || (aSide > 5)) { - return 0; - } - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { - return ((IGregTechTileEntity) tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)); - } - return 0; - } - - @Override - public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { - if ((aSide < 0) || (aSide > 5)) { - return 0; - } - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { - return ((IGregTechTileEntity) tTileEntity).getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)); - } - 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 BaseMetaTileEntityEx)) && (GregTech_API.sMachineNonWrenchExplosions)) { - ((BaseMetaTileEntityEx) 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 aSide) { - if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) { - return true; - } - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity != null) { - if ((tTileEntity instanceof BaseMetaTileEntityEx)) { - return true; - } - if (((tTileEntity instanceof BaseMetaPipeEntity)) && ((((BaseMetaPipeEntity) tTileEntity).mConnections & 0xFFFFFFC0) != 0)) { - return true; - } - if (((tTileEntity instanceof ICoverable)) && (((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide.ordinal()) != 0)) { - return true; - } - } - return false; - } - - @Override - public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity == null) { - return 0; - } - if ((tTileEntity instanceof IGregTechTileEntity)) { - return ((IGregTechTileEntity) tTileEntity).getLightOpacity(); - } - return 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); - if ((tTileEntity instanceof BaseMetaTileEntityEx)) { - return ((BaseMetaTileEntityEx) tTileEntity).getLightValue(); - } - return 0; - } - - @Override //TODO - public TileEntity createTileEntity(World aWorld, int aMeta) { - if (aMeta < 4) { - return Meta_GT_Proxy.constructBaseMetaTileEntity(); - } - return new BaseMetaPipeEntity(); - } - - @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); - if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { - return ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6); - } - return 10.0F; - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { - for (int i = 1; i < Meta_GT_Proxy.METATILEENTITIES.length; i++) { - if (Meta_GT_Proxy.METATILEENTITIES[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) { - return; - } - if ((tTileEntity instanceof IGregTechTileEntity)) { - IGregTechTileEntity var6 = (IGregTechTileEntity) tTileEntity; - if (aPlayer == null) { - var6.setFrontFacing((byte) 1); - } else { - int var7 = MathHelper.floor_double(aPlayer.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3; - int var8 = Math.round(aPlayer.rotationPitch); - if ((var8 >= 65) && (var6.isValidFacing((byte) 1))) { - var6.setFrontFacing((byte) 1); - } else if ((var8 <= -65) && (var6.isValidFacing((byte) 0))) { - var6.setFrontFacing((byte) 0); - } else { - switch (var7) { - case 0: - var6.setFrontFacing((byte) 2); - break; - case 1: - var6.setFrontFacing((byte) 5); - break; - case 2: - var6.setFrontFacing((byte) 3); - break; - case 3: - var6.setFrontFacing((byte) 4); - } - } - } - } - } - - @Override - public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) { - TileEntity tTileEntity = aPlayer.worldObj.getTileEntity(aX, aY, aZ); - if ((tTileEntity instanceof BaseMetaTileEntityEx)) { - return ((BaseMetaTileEntityEx) tTileEntity).getDebugInfo(aPlayer, aLogLevel); - } - if ((tTileEntity instanceof BaseMetaPipeEntity)) { - return ((BaseMetaPipeEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel); - } - return 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 ^ 0xFFFFFFFF) & 0xF)) { - return false; - } - ((IGregTechTileEntity) tTileEntity).setColorization((byte) ((aColor ^ 0xFFFFFFFF) & 0xF)); - return true; - } - return false; - } -} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java deleted file mode 100644 index b150ea32cb..0000000000 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java +++ /dev/null @@ -1,555 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.storage; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_AdvancedWorkbench; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_AdvancedWorkbench; - -import java.util.ArrayList; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.fluids.FluidStack; - -public class GT_MetaTileEntity_AdvancedCraftingTable -extends GT_MetaTileEntity_BasicTank -{ - public boolean mFlushMode = false; - - public GT_MetaTileEntity_AdvancedCraftingTable(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, "WorkBench pro noSc0pe"); - } - - public GT_MetaTileEntity_AdvancedCraftingTable(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - Utils.LOG_INFO("Right Click on Block"); - if (aBaseMetaTileEntity.isClientSide()){ - Utils.LOG_INFO("MTE is ClientSide"); - return true; - } - Utils.LOG_INFO("MTE is not ClientSide"); - aBaseMetaTileEntity.openGUI(aPlayer); - Utils.LOG_INFO("MTE is now has an open GUI"); - return true; - } - - @Override - public String[] getInfoData() { - - if (mFluid == null) { - return new String[]{ - GT_Values.VOLTAGE_NAMES[mTier]+" Workbench", - "Stored Fluid:", - "No Fluid", - Integer.toString(0) + "L", - Integer.toString(getCapacity()) + "L"}; - } - return new String[]{ - GT_Values.VOLTAGE_NAMES[mTier]+" Workbench", - "Stored Fluid:", - mFluid.getLocalizedName(), - Integer.toString(mFluid.amount) + "L", - Integer.toString(getCapacity()) + "L"}; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - Utils.LOG_INFO("Dumping Fluid data. Name: "+mFluid.getFluid().getName()+" Amount: "+mFluid.amount+"L"); - if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); - } - - @Override - public boolean isTransformerUpgradable() - { - return true; - } - - public boolean isBatteryUpgradable() - { - return true; - } - - @Override - public boolean isSimpleMachine() - { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) - { - return (aIndex < 31) || (aIndex > 32); - } - - @Override - public boolean isFacingValid(byte aFacing) - { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) - { - return true; - } - - @Override - public boolean isEnetInput() - { - return true; - } - - @Override - public boolean isInputFacing(byte aSide) - { - return true; - } - - @Override - public long maxEUInput() - { - return 128; - } - - @Override - public long maxEUStore() - { - return 128000; - } - - public int getInvSize() - { - return 35; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT_MetaTileEntity_AdvancedCraftingTable(mName, mTier, mDescription, mTextures); - } - - public void onRightclick(EntityPlayer aPlayer) - { - getBaseMetaTileEntity().openGUI(aPlayer, 160); - } - - public void onFirstTick() - { - getCraftingOutput(); - } - - @Override - public boolean doesFillContainers() - { - return false; - } - - @Override - public boolean doesEmptyContainers() - { - return false; - } - - @Override - public boolean canTankBeFilled() - { - return true; - } - - @Override - public boolean canTankBeEmptied() - { - return true; - } - - @Override - public boolean displaysItemStack() - { - return false; - } - - @Override - public boolean displaysStackSize() - { - return false; - } - - public void onPostTick() - { - if (getBaseMetaTileEntity().isServerSide()) - { - if (getBaseMetaTileEntity().hasInventoryBeenModified()) { - getCraftingOutput(); - } - fillLiquidContainers(); - if (this.mFlushMode) - { - this.mFlushMode = false; - for (byte i = 21; i < 30; i = (byte)(i + 1)) { - if (this.mInventory[i] != null) { - if (this.mInventory[i].stackSize == 0) - { - this.mInventory[i] = null; - } - else - { - this.mFlushMode = true; - break; - } - } - } - } - } - } - - public void sortIntoTheInputSlots() - { - for (byte i = 21; i < 30; i = (byte)(i + 1)) { - if (this.mInventory[i] != null) - { - if (this.mInventory[i].stackSize == 0) { - this.mInventory[i] = null; - } - if (this.mInventory[i] != null) { - for (byte j = 0; j < 16; j = (byte)(j + 1)) { - if (GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j])) { - GT_Utility.moveStackFromSlotAToSlotB(getBaseMetaTileEntity(), getBaseMetaTileEntity(), i, j, (byte)64, (byte)1, (byte)64, (byte)1); - } - } - } - if (this.mInventory[i] != null) { - for (byte j = 0; j < 16; j = (byte)(j + 1)) { - if (this.mInventory[j] == null) { - GT_Utility.moveStackFromSlotAToSlotB(getBaseMetaTileEntity(), getBaseMetaTileEntity(), i, j, (byte)64, (byte)1, (byte)64, (byte)1); - } - } - } - } - } - } - - private void fillLiquidContainers() - { - for (byte i = 16; (i < 21) && (this.mFluid != null); i = (byte)(i + 1)) - { - ItemStack tOutput = GT_Utility.fillFluidContainer(this.mFluid, this.mInventory[i], true, true); - if (tOutput != null) - { - if (this.mInventory[i].stackSize == 1) - { - this.mFluid.amount -= GT_Utility.getFluidForFilledItem(tOutput, true).amount * tOutput.stackSize; - this.mInventory[i] = tOutput; - } - else - { - for (byte j = 16; j < 21; j = (byte)(j + 1)) { - if ((this.mInventory[j] == null) || ((GT_Utility.areStacksEqual(tOutput, this.mInventory[j])) && (this.mInventory[j].stackSize + tOutput.stackSize <= tOutput.getMaxStackSize()))) - { - this.mFluid.amount -= GT_Utility.getFluidForFilledItem(tOutput, true).amount * tOutput.stackSize; - getBaseMetaTileEntity().decrStackSize(i, 1); - if (this.mInventory[j] == null) - { - this.mInventory[j] = tOutput; break; - } - this.mInventory[j].stackSize += 1; - - break; - } - } - } - if ((this.mFluid != null) && (this.mFluid.amount <= 0)) { - this.mFluid = null; - } - } - } - if ((this.mFluid != null) && (this.mFluid.amount <= 0)) { - this.mFluid = null; - } - } - - public void setBluePrint(ItemStack aStack) - { - if (aStack == null) { - aStack = this.mInventory[30]; - } - if ((this.mInventory[31] == null) || (aStack == null) /*|| (aStack.itemID != -2)*/ || (aStack.getItemDamage() != 0) || (aStack.stackSize != 1) || (aStack.hasTagCompound())) { - return; - } - NBTTagCompound tNBT = new NBTTagCompound(); - NBTTagList tNBT_ItemList = new NBTTagList(); - for (int i = 0; i < 9; i++) - { - ItemStack tStack = this.mInventory[(i + 21)]; - if (tStack != null) - { - NBTTagCompound tag = new NBTTagCompound(); - tag.setByte("Slot", (byte)i); - tStack.writeToNBT(tag); - tNBT_ItemList.appendTag(tag); - } - } - tNBT.setTag("Inventory", tNBT_ItemList); - aStack.setTagCompound(tNBT); - } - - public ItemStack getCraftingOutput() - { - if ((this.mInventory[30] != null) /*&& (this.mInventory[30].itemID == -2)*/ && (this.mInventory[30].getItemDamage() == 0) && (this.mInventory[30].hasTagCompound())) - { - NBTTagCompound tNBT = this.mInventory[30].getTagCompound(); - NBTTagList tNBT_ItemList = tNBT.getTagList("Blueprint", 10); //TODO - for (int i = 0; (i < tNBT_ItemList.tagCount()) && (i < 9); i++) - { - NBTTagCompound tag = (NBTTagCompound)tNBT_ItemList.getCompoundTagAt(i); - byte slot = tag.getByte("Slot"); - if ((slot >= 0) && (slot < 9) && (this.mInventory[(slot + 21)] == null)) - { - this.mInventory[(slot + 21)] = GT_Utility.loadItem(tag); - if (this.mInventory[(slot + 21)] != null) { - this.mInventory[(slot + 21)].stackSize = 0; - } - } - } - } - this.mInventory[31] = GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), new ItemStack[] { this.mInventory[21], this.mInventory[22], this.mInventory[23], this.mInventory[24], this.mInventory[25], this.mInventory[26], this.mInventory[27], this.mInventory[28], this.mInventory[29] }); - return this.mInventory[31]; - } - - public boolean canDoCraftingOutput() - { - if (this.mInventory[31] == null) { - return false; - } - for (ItemStack tStack : recipeContent()) { - if (tStack.stackSize > getAmountOf(tStack)) { - return false; - } - } - return true; - } - - private int getAmountOf(ItemStack aStack) - { - int tAmount = 0; - for (byte i = 0; (i < 30) && (tAmount < 9); i = (byte)(i + 1)) { - if (GT_Utility.areStacksOrToolsEqual(aStack, this.mInventory[i])) { - tAmount += this.mInventory[i].stackSize; - } - } - return tAmount; - } - - private ArrayList<ItemStack> recipeContent() - { - ArrayList<ItemStack> tList = new ArrayList(); - for (byte i = 21; i < 30; i = (byte)(i + 1)) { - if (this.mInventory[i] != null) - { - boolean temp = false; - for (byte j = 0; j < tList.size(); j = (byte)(j + 1)) { - if (GT_Utility.areStacksOrToolsEqual(this.mInventory[i], (ItemStack)tList.get(j))) - { - ((ItemStack)tList.get(j)).stackSize += 1; - temp = true; - break; - } - } - if (!temp) { - tList.add(GT_Utility.copyAmount(1L, new Object[] { this.mInventory[i] })); - } - } - } - return tList; - } - - public ItemStack consumeMaterials(EntityPlayer aPlayer, ItemStack aHoldStack) - { - if (this.mInventory[31] == null) { - return aHoldStack; - } - if (aHoldStack != null) - { - if (!GT_Utility.areStacksEqual(aHoldStack, this.mInventory[31])) { - return aHoldStack; - } - if (aHoldStack.stackSize + this.mInventory[31].stackSize > aHoldStack.getMaxStackSize()) { - return aHoldStack; - } - } - for (byte i = 21; i < 30; i = (byte)(i + 1)) { - if (this.mInventory[i] != null) { - for (byte j = 0; j <= i; j = (byte)(j + 1)) { - if (((j < 21) || (j == i)) && - (GT_Utility.areStacksOrToolsEqual(this.mInventory[i], this.mInventory[j])) && (this.mInventory[j].stackSize > 0)) - { - ItemStack tStack = GT_Utility.getContainerItem(this.mInventory[j], true); - if ((tStack == null) || ((tStack.isItemStackDamageable()) && (tStack.getItemDamage() >= tStack.getMaxDamage()))) - { - getBaseMetaTileEntity().decrStackSize(j, 1); break; - } - if (this.mInventory[j].stackSize == 1) - { - this.mInventory[j] = tStack; break; - } - getBaseMetaTileEntity().decrStackSize(j, 1); - for (byte k = 0; k < 21; k = (byte)(k + 1)) - { - if (this.mInventory[k] == null) - { - this.mInventory[k] = tStack; - break; - } - if ((GT_Utility.areStacksEqual(tStack, this.mInventory[k])) && - (tStack.stackSize + this.mInventory[k].stackSize <= this.mInventory[k].getMaxStackSize())) - { - this.mInventory[k].stackSize += tStack.stackSize; - break; - } - } - break; - } - } - } - } - if (aHoldStack == null) - { - aHoldStack = GT_Utility.copy(new Object[] { this.mInventory[31] }); - aHoldStack.onCrafting(getBaseMetaTileEntity().getWorld(), aPlayer, this.mInventory[31].stackSize); - } - else - { - aHoldStack.stackSize += this.mInventory[31].stackSize; - aHoldStack.onCrafting(getBaseMetaTileEntity().getWorld(), aPlayer, this.mInventory[31].stackSize); - } - fillLiquidContainers(); - - return aHoldStack; - } - - @Override - public long getInputTier() - { - return GT_Utility.getTier(getBaseMetaTileEntity().getInputVoltage()); - } - - @Override - public long getOutputTier() - { - return GT_Utility.getTier(getBaseMetaTileEntity().getInputVoltage()); - } - - @Override - public int rechargerSlotStartIndex() - { - return 16; - } - - @Override - public int rechargerSlotCount() - { - return 5; - } - - public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) - { - if (aSide == 0) { - return 32; - } - if (aSide == 1) { - return 290; - } - if ((aFacing == 0) || (aFacing == 1)) { - return 222; - } - if ((aFacing == 2) || (aFacing == 3)) { - return 223; - } - return 215; - } - - @Override - public String[] getDescription() - { - return new String[]{"For the very large Projects"}; - } - - public boolean allowPutStack(int aIndex, byte aSide, ItemStack aStack) - { - if (aIndex < 16) - { - for (byte i = 0; i < 16; i = (byte)(i + 1)) { - if (GT_Utility.areStacksOrToolsEqual(aStack, this.mInventory[i])) { - return aIndex == i; - } - } - return true; - } - return false; - } - - public boolean allowPullStack(int aIndex, byte aSide, ItemStack aStack) - { - return (aIndex == 33) || ((this.mFlushMode) && (aIndex >= 21) && (aIndex < 30)); - } - - @Override - public int getCapacity() - { - return 64000; - } - - @Override - public int getTankPressure() - { - return -100; - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new CONTAINER_AdvancedWorkbench(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new GUI_AdvancedWorkbench(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - return new ITexture[0][0][0]; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return aSide == 1 ? new ITexture[]{ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CRAFTING)} : new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEEL_SIDE), new GT_RenderedTexture(Textures.BlockIcons.VOID)}; - } -} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java deleted file mode 100644 index d0f15c5da2..0000000000 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java +++ /dev/null @@ -1,160 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.storage; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_BronzeWorkbench; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_BronzeWorkbench; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; - -public class GT_MetaTileEntity_BronzeCraftingTable -extends GT_MetaTileEntity_AdvancedCraftingTable -{ - public GT_MetaTileEntity_BronzeCraftingTable(int aID, String aName, String aNameRegional, int aTier) - { - super(aID, aName, aNameRegional, aTier); - } - - public GT_MetaTileEntity_BronzeCraftingTable(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - } - @Override - public boolean isElectric() - { - return false; - } - - @Override - public boolean isPneumatic() - { - return false; - } - - @Override - public boolean isSteampowered() - { - return false; - } - - @Override - public boolean isTransformerUpgradable() - { - return false; - } - - @Override - public boolean isBatteryUpgradable() - { - return false; - } - - @Override - public boolean isEnetInput() - { - return false; - } - - @Override - public boolean isInputFacing(byte aSide) - { - return false; - } - - @Override - public long maxEUInput() - { - return 0; - } - - @Override - public long maxEUStore() - { - return 0; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) - { - return new GT_MetaTileEntity_BronzeCraftingTable(mName, mTier, mDescription, mTextures); - } - - @Override - public void onRightclick(EntityPlayer aPlayer) - { - getBaseMetaTileEntity().openGUI(aPlayer, 161); - } - - @SuppressWarnings({ "static-method", "unused" }) - public boolean allowCoverOnSide(byte aSide, int aCoverID) - { - return GregTech_API.getCoverBehavior(aCoverID).isSimpleCover(); - } - - @Override - public int rechargerSlotStartIndex() - { - return 0; - } - - @Override - public int rechargerSlotCount() - { - return 0; - } - - @Override - public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) - { - if (aSide == 0) { - return 315; - } - if (aSide == 1) { - return 317; - } - if ((aFacing == 0) || (aFacing == 1)) { - return 318; - } - if ((aFacing == 2) || (aFacing == 3)) { - return 319; - } - return 320; - } - - @Override - public String[] getDescription() - { - return new String[] {"For the smaller Projects"}; - } - - @Override - public int getCapacity() - { - return 16000; - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new CONTAINER_BronzeWorkbench(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) - { - return new GUI_BronzeWorkbench(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - return new ITexture[0][0][0]; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return aSide == 1 ? new ITexture[]{ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CRAFTING)} : new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZE_SIDE), new GT_RenderedTexture(Textures.BlockIcons.VOID)}; - } -} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java index b0ea5cff3c..0c9a113070 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java @@ -7,192 +7,179 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.fluid.FluidUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -public class GT_MetaTileEntity_TieredTank - extends GT_MetaTileEntity_BasicTank { - - private NBTTagCompound mRecipeStuff = new NBTTagCompound(); - - /*protected String fluidName = getFluidName(); - protected int fluidAmount = getInternalFluidAmount();*/ - - /*private String getFluidName(){ - String x; - if (internalTank != null){ - x = internalTank.getFluid().getName(); +public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank { + + private NBTTagCompound mRecipeStuff = new NBTTagCompound(); + private String thisName = ""; + private int thisAmount = 0; + + public GT_MetaTileEntity_TieredTank(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 3, "Stores " + ((int) (Math.pow(2, aTier) * 32000)) + "L of fluid"); + } + + public GT_MetaTileEntity_TieredTank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + @Override + public String[] getDescription() { + NBTTagCompound dRecipeStuff = this.mRecipeStuff; + if (dRecipeStuff != null){ + this.thisName = dRecipeStuff.getString("xFluidName"); + this.thisAmount = dRecipeStuff.getInteger("xFluidAmount"); + if (this.thisName.equals("")){ + this.thisName = "Empty"; + } + if (this.thisName == "Empty" && this.thisAmount == 0){ + //Do Nothing + } + else { + return new String[] {mDescription, "Stored Fluid: "+this.thisName, "Stored Amount: "+this.thisAmount+"l", CORE.GT_Tooltip}; + } } - else { - x = "null"; + return new String[] {mDescription, CORE.GT_Tooltip}; + } + + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + return new ITexture[0][0][0]; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER)}; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + //Utils.LOG_INFO("Dumping Fluid data. Name: "+mFluid.getFluid().getName()+" Amount: "+mFluid.amount+"L"); + if (mFluid != null){ + aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); + mRecipeStuff.setString("xFluidName", mFluid.getFluid().getName()); + mRecipeStuff.setInteger("xFluidAmount", mFluid.amount); + aNBT.setTag("GT.CraftingComponents", mRecipeStuff); + this.thisName = mRecipeStuff.getString("xFluidName"); + this.thisAmount = mRecipeStuff.getInteger("xFluidAmount"); } - return x; + + + + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mRecipeStuff = aNBT.getCompoundTag("GT.CraftingComponents"); + this.thisName = mRecipeStuff.getString("xFluidName"); + this.thisAmount = mRecipeStuff.getInteger("xFluidAmount"); + //mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); + mFluid = FluidUtils.getFluidStack(mRecipeStuff.getString("xFluidName"), mRecipeStuff.getInteger("xFluidAmount")); } - - private int getInternalFluidAmount(){ - int x; - if (internalTank != null){ - x = internalTank.amount; + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()){ + return true; } - else { - x = 0; + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return true; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public final byte getUpdateData() { + return 0x00; + } + + @Override + public boolean doesFillContainers() { + return true; + } + + @Override + public boolean doesEmptyContainers() { + return true; + } + + @Override + public boolean canTankBeFilled() { + return true; + } + + @Override + public boolean canTankBeEmptied() { + return true; + } + + @Override + public boolean displaysItemStack() { + return true; + } + + @Override + public boolean displaysStackSize() { + return false; + } + + @Override + public String[] getInfoData() { + + if (mFluid == null) { + return new String[]{ + GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank", + "Stored Fluid:", + "No Fluid", + Integer.toString(0) + "L", + Integer.toString(getCapacity()) + "L"}; } - return x; - }*/ - - public GT_MetaTileEntity_TieredTank(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, "Stores " + ((int) (Math.pow(2, aTier) * 32000)) + "L of fluid"); - } - - public GT_MetaTileEntity_TieredTank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - return new ITexture[0][0][0]; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER)}; - } - - /* @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - }*/ - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - Utils.LOG_INFO("Dumping Fluid data. Name: "+mFluid.getFluid().getName()+" Amount: "+mFluid.amount+"L"); - if (mFluid != null){ - aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); - mRecipeStuff.setString("xFluidName", mFluid.getFluid().getName()); - mRecipeStuff.setInteger("xFluidAmount", mFluid.amount); - aNBT.setTag("GT.CraftingComponents", mRecipeStuff); - } - - - - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mRecipeStuff = aNBT.getCompoundTag("GT.CraftingComponents"); - //mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); - mFluid = FluidUtils.getFluidStack(mRecipeStuff.getString("xFluidName"), mRecipeStuff.getInteger("xFluidAmount")); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - Utils.LOG_INFO("Right Click on Block"); - if (aBaseMetaTileEntity.isClientSide()){ - Utils.LOG_INFO("MTE is ClientSide"); - return true; - } - Utils.LOG_INFO("MTE is not ClientSide"); - aBaseMetaTileEntity.openGUI(aPlayer); - Utils.LOG_INFO("MTE is now has an open GUI"); - return true; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public final byte getUpdateData() { - return 0x00; - } - - @Override - public boolean doesFillContainers() { - return true; - } - - @Override - public boolean doesEmptyContainers() { - return true; - } - - @Override - public boolean canTankBeFilled() { - return true; - } - - @Override - public boolean canTankBeEmptied() { - return true; - } - - @Override - public boolean displaysItemStack() { - return true; - } - - @Override - public boolean displaysStackSize() { - return false; - } - - @Override - public String[] getInfoData() { - - if (mFluid == null) { - return new String[]{ - GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank", - "Stored Fluid:", - "No Fluid", - Integer.toString(0) + "L", - Integer.toString(getCapacity()) + "L"}; - } - return new String[]{ - GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank", - "Stored Fluid:", - mFluid.getLocalizedName(), - Integer.toString(mFluid.amount) + "L", - Integer.toString(getCapacity()) + "L"}; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TieredTank(mName, mTier, mDescription, mTextures); - } - - @Override - public int getCapacity() { - return (int) (Math.pow(2, mTier) * 32000); - } - - @Override - public int getTankPressure() { - return 100; - } + return new String[]{ + GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank", + "Stored Fluid:", + mFluid.getLocalizedName(), + Integer.toString(mFluid.amount) + "L", + Integer.toString(getCapacity()) + "L"}; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TieredTank(mName, mTier, mDescription, mTextures); + } + + @Override + public int getCapacity() { + this.thisName = mRecipeStuff.getString("xFluidName"); + this.thisAmount = mRecipeStuff.getInteger("xFluidAmount"); + return (int) (Math.pow(2, mTier) * 32000); + } + + @Override + public int getTankPressure() { + return 100; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_NBT_Tank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_NBT_Tank.java deleted file mode 100644 index 77787cd2bf..0000000000 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_NBT_Tank.java +++ /dev/null @@ -1,202 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.storage; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntityEx; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTankEx; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.core.util.Utils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; - -public class GT_NBT_Tank - extends GT_MetaTileEntity_BasicTankEx { - - - /*protected String fluidName = getFluidName(); - protected int fluidAmount = getInternalFluidAmount();*/ - - /*private String getFluidName(){ - String x; - if (internalTank != null){ - x = internalTank.getFluid().getName(); - } - else { - x = "null"; - } - return x; - } - - private int getInternalFluidAmount(){ - int x; - if (internalTank != null){ - x = internalTank.amount; - } - else { - x = 0; - } - return x; - }*/ - - public GT_NBT_Tank(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, "Stores " + ((int) (Math.pow(2, aTier) * 32000)) + "L of fluid"); - } - - public GT_NBT_Tank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - return new ITexture[0][0][0]; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER)}; - } - - /* @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - }*/ - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - Utils.LOG_INFO("Dumping Fluid data. Name: "+mFluid.getFluid().getName()+" Amount: "+mFluid.amount+"L"); - if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - Utils.LOG_INFO("Right Click on Block"); - if (aBaseMetaTileEntity.isClientSide()){ - Utils.LOG_INFO("MTE is ClientSide"); - return true; - } - Utils.LOG_INFO("MTE is not ClientSide"); - aBaseMetaTileEntity.openGUI(aPlayer); - Utils.LOG_INFO("MTE is now has an open GUI"); - return true; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public final byte getUpdateData() { - return 0x00; - } - - @Override - public boolean doesFillContainers() { - return true; - } - - @Override - public boolean doesEmptyContainers() { - return true; - } - - @Override - public boolean canTankBeFilled() { - return true; - } - - @Override - public boolean canTankBeEmptied() { - return true; - } - - @Override - public boolean displaysItemStack() { - return true; - } - - @Override - public boolean displaysStackSize() { - return false; - } - - @Override - public String[] getInfoData() { - - if (mFluid == null) { - return new String[]{ - GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank", - "Stored Fluid:", - "No Fluid", - Integer.toString(0) + "L", - Integer.toString(getCapacity()) + "L"}; - } - return new String[]{ - GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank", - "Stored Fluid:", - mFluid.getLocalizedName(), - Integer.toString(mFluid.amount) + "L", - Integer.toString(getCapacity()) + "L"}; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public MetaTileEntityEx newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_NBT_Tank(mName, mTier, mDescription, mTextures); - } - - @Override - public int getCapacity() { - return (int) (Math.pow(2, mTier) * 32000); - } - - @Override - public int getTankPressure() { - return 100; - } - - @Override - public void sendSound(byte aIndex) { - - } - - @Override - public void sendLoopStart(byte aIndex) { - - } - - @Override - public void sendLoopEnd(byte aIndex) { - - } - -}
\ No newline at end of file |