diff options
Diffstat (limited to 'src/main/java/gregtech/common/blocks/GT_Item_Machines.java')
-rw-r--r-- | src/main/java/gregtech/common/blocks/GT_Item_Machines.java | 204 |
1 files changed, 138 insertions, 66 deletions
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java index 9cf4029934..95de8da0c2 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java @@ -1,5 +1,7 @@ package gregtech.common.blocks; +import static gregtech.GT_Mod.GT_FML_LOGGER; + import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -8,18 +10,16 @@ import gregtech.api.interfaces.metatileentity.IConnectable; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.CoverableTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Frame; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Item; -import gregtech.api.util.GT_CoverBehaviorBase; 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 gregtech.api.util.ISerializableObject; import gregtech.common.tileentities.storage.*; +import java.util.List; +import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -34,11 +34,6 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; -import javax.annotation.Nullable; -import java.util.List; - -import static gregtech.GT_Mod.GT_FML_LOGGER; - public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { public GT_Item_Machines(Block block) { super(block); @@ -47,15 +42,12 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { setCreativeTab(GregTech_API.TAB_GREGTECH); } - public static IMetaTileEntity getMetaTileEntity(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) - return null; - if (!(aStack.getItem() instanceof GT_Item_Machines)) - return null; - if (aStack.getItemDamage() < 0 || aStack.getItemDamage() > GregTech_API.METATILEENTITIES.length) - return null; - return GregTech_API.METATILEENTITIES[aStack.getItemDamage()]; - } + public static IMetaTileEntity getMetaTileEntity(ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) return null; + if (!(aStack.getItem() instanceof GT_Item_Machines)) return null; + if (aStack.getItemDamage() < 0 || aStack.getItemDamage() > GregTech_API.METATILEENTITIES.length) return null; + return GregTech_API.METATILEENTITIES[aStack.getItemDamage()]; + } @Override @SuppressWarnings("unchecked") @@ -68,45 +60,84 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { if (GregTech_API.METATILEENTITIES[tDamage] != null) { final IGregTechTileEntity tTileEntity = GregTech_API.METATILEENTITIES[tDamage].getBaseMetaTileEntity(); - if (!GregTech_API.sPostloadFinished && tTileEntity.getMetaTileEntity() instanceof ISecondaryDescribable) { - final String[] tSecondaryDescription = ((ISecondaryDescribable) tTileEntity.getMetaTileEntity()).getSecondaryDescription(); + if (!GregTech_API.sPostloadFinished + && tTileEntity.getMetaTileEntity() instanceof ISecondaryDescribable) { + final String[] tSecondaryDescription = + ((ISecondaryDescribable) tTileEntity.getMetaTileEntity()).getSecondaryDescription(); addDescription(null, tSecondaryDescription, tDamage, "_Secondary", true); } { final IMetaTileEntity tMetaTileEntity = tTileEntity.getMetaTileEntity(); - final String tSuffix = (tMetaTileEntity instanceof ISecondaryDescribable && ((ISecondaryDescribable) tMetaTileEntity).isDisplaySecondaryDescription()) ? "_Secondary" : ""; - addDescription(aList, tTileEntity.getDescription(), tDamage, tSuffix, !GregTech_API.sPostloadFinished); + final String tSuffix = (tMetaTileEntity instanceof ISecondaryDescribable + && ((ISecondaryDescribable) tMetaTileEntity).isDisplaySecondaryDescription()) + ? "_Secondary" + : ""; + addDescription( + aList, tTileEntity.getDescription(), tDamage, tSuffix, !GregTech_API.sPostloadFinished); } if (tTileEntity.getEUCapacity() > 0L) { if (tTileEntity.getInputVoltage() > 0L) { final int inputTier = GT_Utility.getTier(tTileEntity.getInputVoltage()); - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tTileEntity.getInputVoltage()) + " (" + GT_Values.TIER_COLORS[inputTier] + GT_Values.VN[inputTier] + EnumChatFormatting.GREEN +")" + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tTileEntity.getInputVoltage()) + + " (" + GT_Values.TIER_COLORS[inputTier] + GT_Values.VN[inputTier] + + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY); } if (tTileEntity.getOutputVoltage() > 0L) { final int outputTier = GT_Utility.getTier(tTileEntity.getOutputVoltage()); - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tTileEntity.getOutputVoltage()) + " (" + GT_Values.TIER_COLORS[outputTier] + GT_Values.VN[outputTier] + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_EUp_OUT", "Voltage OUT: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tTileEntity.getOutputVoltage()) + + " (" + GT_Values.TIER_COLORS[outputTier] + GT_Values.VN[outputTier] + + EnumChatFormatting.GREEN + ")" + EnumChatFormatting.GRAY); } if (tTileEntity.getOutputAmperage() > 1L) { - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_AMOUNT", "Amperage: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(tTileEntity.getOutputAmperage()) + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_EUp_AMOUNT", "Amperage: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.YELLOW + + GT_Utility.formatNumbers(tTileEntity.getOutputAmperage()) + + EnumChatFormatting.GRAY); } - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(tTileEntity.getEUCapacity()) + EnumChatFormatting.GRAY + " EU"); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(tTileEntity.getEUCapacity()) + + EnumChatFormatting.GRAY + " EU"); } - if (GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumTank || GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperTank) { + if (GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumTank + || GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperTank) { if (aStack.hasTagCompound() && aStack.stackTagCompound.hasKey("mFluid")) { - final FluidStack tContents = FluidStack.loadFluidStackFromNBT(aStack.stackTagCompound.getCompoundTag("mFluid")); + final FluidStack tContents = + FluidStack.loadFluidStackFromNBT(aStack.stackTagCompound.getCompoundTag("mFluid")); if (tContents != null && tContents.amount > 0) { - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_TANK_INFO", "Contains Fluid: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + tContents.getLocalizedName() + EnumChatFormatting.GRAY); - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_TANK_AMOUNT", "Fluid Amount: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tContents.amount) + " L" + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_TANK_INFO", "Contains Fluid: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.YELLOW + + tContents.getLocalizedName() + + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_TANK_AMOUNT", "Fluid Amount: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tContents.amount) + " L" + + EnumChatFormatting.GRAY); } } } if (GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_DigitalChestBase) { if (aStack.hasTagCompound() && aStack.stackTagCompound.hasKey("mItemStack")) { - final ItemStack tContents = ItemStack.loadItemStackFromNBT(aStack.stackTagCompound.getCompoundTag("mItemStack")); + final ItemStack tContents = + ItemStack.loadItemStackFromNBT(aStack.stackTagCompound.getCompoundTag("mItemStack")); final int tSize = aStack.stackTagCompound.getInteger("mItemCount"); if (tContents != null && tSize > 0) { - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_CHEST_INFO", "Contains Item: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + tContents.getDisplayName() + EnumChatFormatting.GRAY); - aList.add(GT_LanguageManager.addStringLocalization("TileEntity_CHEST_AMOUNT", "Item Amount: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tSize) + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_CHEST_INFO", "Contains Item: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.YELLOW + + tContents.getDisplayName() + + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization( + "TileEntity_CHEST_AMOUNT", "Item Amount: ", !GregTech_API.sPostloadFinished) + + EnumChatFormatting.GREEN + + GT_Utility.formatNumbers(tSize) + + EnumChatFormatting.GRAY); } } } @@ -114,14 +145,20 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { final NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { if (aNBT.getBoolean("mMuffler")) { - aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade", !GregTech_API.sPostloadFinished )); + aList.add(GT_LanguageManager.addStringLocalization( + "GT_TileEntity_MUFFLER", "has Muffler Upgrade", !GregTech_API.sPostloadFinished)); } if (aNBT.getBoolean("mSteamConverter")) { - aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER", "has Steam Upgrade", !GregTech_API.sPostloadFinished )); + aList.add(GT_LanguageManager.addStringLocalization( + "GT_TileEntity_STEAMCONVERTER", "has Steam Upgrade", !GregTech_API.sPostloadFinished)); } int tAmount = 0; if ((tAmount = aNBT.getByte("mSteamTanks")) > 0) { - aList.add(tAmount + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", "Steam Tank Upgrades", !GregTech_API.sPostloadFinished )); + aList.add(tAmount + " " + + GT_LanguageManager.addStringLocalization( + "GT_TileEntity_STEAMTANKS", + "Steam Tank Upgrades", + !GregTech_API.sPostloadFinished)); } CoverableTileEntity.addInstalledCoversInformation(aNBT, aList); @@ -131,7 +168,12 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { } } - private void addDescription(@Nullable List<String> aList, @Nullable String[] aDescription, int aDamage, String aSuffix, boolean aWriteIntoLangFile) { + private void addDescription( + @Nullable List<String> aList, + @Nullable String[] aDescription, + int aDamage, + String aSuffix, + boolean aWriteIntoLangFile) { if (aDescription == null) return; for (int i = 0, tLength = aDescription.length; i < tLength; i++) { String tDescLine = aDescription[i]; @@ -148,7 +190,9 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { tBuffer.append(" %s"); tRep[j / 2] = tSplitStrings[j]; } - final String tTranslated = String.format(GT_LanguageManager.addStringLocalization(tKey, tBuffer.toString(), aWriteIntoLangFile), (Object[]) tRep); + final String tTranslated = String.format( + GT_LanguageManager.addStringLocalization(tKey, tBuffer.toString(), aWriteIntoLangFile), + (Object[]) tRep); if (aList != null) aList.add(tTranslated); } else { String tTranslated = GT_LanguageManager.addStringLocalization(tKey, tDescLine, aWriteIntoLangFile); @@ -158,7 +202,17 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { } @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { + 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; } @@ -176,37 +230,52 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { @Override public String getItemStackDisplayName(ItemStack aStack) { - String aName = super.getItemStackDisplayName(aStack); - final short aDamage = (short) getDamage(aStack); - if (aDamage >= 0 && aDamage < GregTech_API.METATILEENTITIES.length && GregTech_API.METATILEENTITIES[aDamage] != null) { + String aName = super.getItemStackDisplayName(aStack); + final short aDamage = (short) getDamage(aStack); + if (aDamage >= 0 + && aDamage < GregTech_API.METATILEENTITIES.length + && GregTech_API.METATILEENTITIES[aDamage] != null) { Materials aMaterial = null; if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Item) { - aMaterial = ((GT_MetaPipeEntity_Item) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; + aMaterial = ((GT_MetaPipeEntity_Item) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; } else if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Fluid) { - aMaterial = ((GT_MetaPipeEntity_Fluid) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; + aMaterial = ((GT_MetaPipeEntity_Fluid) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; } else if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Cable) { - aMaterial = ((GT_MetaPipeEntity_Cable) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; + aMaterial = ((GT_MetaPipeEntity_Cable) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; } else if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Frame) { - aMaterial = ((GT_MetaPipeEntity_Frame) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; + aMaterial = ((GT_MetaPipeEntity_Frame) GregTech_API.METATILEENTITIES[aDamage]).mMaterial; } if (aMaterial != null) { - aName = aMaterial.getLocalizedNameForItem(aName); + aName = aMaterial.getLocalizedNameForItem(aName); } } - return aName; + return aName; } @Override public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { super.onCreated(aStack, aWorld, aPlayer); final short tDamage = (short) getDamage(aStack); - if ((tDamage < 0) || ((tDamage >= GregTech_API.METATILEENTITIES.length) && (GregTech_API.METATILEENTITIES[tDamage] != null))) { + 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) { + 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) { final short tDamage = (short) getDamage(aStack); if (tDamage > 0) { if (GregTech_API.METATILEENTITIES[tDamage] == null) { @@ -217,10 +286,12 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { 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."); + 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."); + 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."); } final IGregTechTileEntity tTileEntity = (IGregTechTileEntity) aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity != null) { @@ -233,12 +304,12 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { final byte aSide = GT_Utility.getOppositeSide(side); if (tTileEntity.getMetaTileEntity() instanceof IConnectable) { // If we're connectable, try connecting to whatever we're up against - ((IConnectable) tTileEntity.getMetaTileEntity()).connect(aSide); + ((IConnectable) tTileEntity.getMetaTileEntity()).connect(aSide); } else if (aPlayer != null && aPlayer.isSneaking()) { // If we're being placed against something that is connectable, try telling it to connect to us final IGregTechTileEntity aTileEntity = tTileEntity.getIGregTechTileEntityAtSide(aSide); if (aTileEntity != null && aTileEntity.getMetaTileEntity() instanceof IConnectable) { - ((IConnectable) aTileEntity.getMetaTileEntity()).connect((byte)side); + ((IConnectable) aTileEntity.getMetaTileEntity()).connect((byte) side); } } } @@ -257,18 +328,19 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { super.onUpdate(aStack, aWorld, aPlayer, aTimer, aIsInHand); final short tDamage = (short) getDamage(aStack); final EntityLivingBase tPlayer = (EntityPlayer) aPlayer; - if (GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperChest || - GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumChest || - GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperTank || - GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumTank) { + if (GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperChest + || GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumChest + || GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperTank + || GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumTank) { final NBTTagCompound tNBT = aStack.stackTagCompound; if (tNBT == null) return; if (tNBT.hasNoTags()) { aStack.setTagCompound(null); return; } - if ((tNBT.hasKey("mItemCount") && tNBT.getInteger("mItemCount") > 0) || - (tNBT.hasKey("mFluid") && FluidStack.loadFluidStackFromNBT(tNBT.getCompoundTag("mFluid")).amount > 64000)) { + if ((tNBT.hasKey("mItemCount") && tNBT.getInteger("mItemCount") > 0) + || (tNBT.hasKey("mFluid") + && FluidStack.loadFluidStackFromNBT(tNBT.getCompoundTag("mFluid")).amount > 64000)) { final FluidStack tFluid = FluidStack.loadFluidStackFromNBT(tNBT.getCompoundTag("mFluid")); int tLasing = 1200; if (tFluid != null) { @@ -303,8 +375,7 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { if (container != null) { final int tDamage = container.getItemDamage(); final IMetaTileEntity tMetaTile = GregTech_API.METATILEENTITIES[tDamage]; - if (tMetaTile != null) - return tMetaTile.getCapacity(); + if (tMetaTile != null) return tMetaTile.getCapacity(); } return 0; } @@ -314,7 +385,8 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { if (container != null && resource != null) { final int tDamage = container.getItemDamage(); final IMetaTileEntity tMetaTile = GregTech_API.METATILEENTITIES[tDamage]; - if (!(tMetaTile instanceof GT_MetaTileEntity_QuantumTank || tMetaTile instanceof GT_MetaTileEntity_SuperTank)) { + if (!(tMetaTile instanceof GT_MetaTileEntity_QuantumTank + || tMetaTile instanceof GT_MetaTileEntity_SuperTank)) { return 0; } if (container.stackTagCompound == null) container.stackTagCompound = new NBTTagCompound(); @@ -346,7 +418,8 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { if (container != null && container.hasTagCompound()) { final int tDamage = container.getItemDamage(); final IMetaTileEntity tMetaTile = GregTech_API.METATILEENTITIES[tDamage]; - if (!(tMetaTile instanceof GT_MetaTileEntity_QuantumTank || tMetaTile instanceof GT_MetaTileEntity_SuperTank)) { + if (!(tMetaTile instanceof GT_MetaTileEntity_QuantumTank + || tMetaTile instanceof GT_MetaTileEntity_SuperTank)) { return null; } final FluidStack tStoredFluid = getFluid(container); @@ -357,8 +430,7 @@ public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { if (doDrain) { if (tNewFluid.amount <= 0) { container.stackTagCompound.removeTag("mFluid"); - if (container.stackTagCompound.hasNoTags()) - container.setTagCompound(null); + if (container.stackTagCompound.hasNoTags()) container.setTagCompound(null); } else { container.stackTagCompound.setTag("mFluid", tNewFluid.writeToNBT(new NBTTagCompound())); } |