From feca5739287583eee824512ff61714ae4113a6fc Mon Sep 17 00:00:00 2001 From: Johnson Date: Thu, 19 Mar 2020 21:09:21 +0500 Subject: Add cover information on the machine item tooltip. (#252) * Add cover information on the machine item tooltip. --- .../gregtech/common/blocks/GT_Item_Machines.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/main/java/gregtech/common/blocks/GT_Item_Machines.java') 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 773268d424..1424a016e8 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java @@ -25,6 +25,9 @@ import java.util.List; public class GT_Item_Machines extends ItemBlock { + + private static final String[] directionNames = {"Bottom", "Top", "North", "South", "West", "East"}; + public GT_Item_Machines(Block par1) { super(par1); setMaxDamage(0); @@ -85,12 +88,29 @@ public class GT_Item_Machines if ((tAmount = aNBT.getByte("mSteamTanks")) > 0) { aList.add(tAmount + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", "Steam Tank Upgrades", !GregTech_API.sPostloadFinished )); } + + addInstalledCoversInformation(aNBT, aList); } } catch (Throwable e) { e.printStackTrace(GT_Log.err); } } + private void addInstalledCoversInformation(NBTTagCompound aNBT, List aList) { + if (aNBT.hasKey("mCoverSides")){ + int[] mCoverSides = aNBT.getIntArray("mCoverSides"); + if (mCoverSides != null && mCoverSides.length == 6) { + for (byte i = 0; i < 6; i++) { + int coverId = mCoverSides[i]; + ItemStack coverStack = GT_Utility.intToStack(coverId); + if (coverStack != null) { + aList.add(String.format("Cover on %s side: %s", directionNames[i], coverStack.getDisplayName())); + } + } + } + } + } + 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; } -- cgit