From 6844c44dcf1c90cf30ca03d595992b5e0fbe909b Mon Sep 17 00:00:00 2001 From: Bruce Wang Date: Mon, 12 Dec 2016 17:41:33 +1100 Subject: [PATCH] backport traveller's sack item count tooltip to 1.10.2 branch (#483) * backport traveller's sack item count tooltip to 1.10.2 branch --- .../actuallyadditions/mod/items/ItemBag.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java index 70a3be6a2..552911e04 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBag.java @@ -56,7 +56,22 @@ public class ItemBag extends ItemBase{ @Override public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced){ - tooltip.add(TextFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".previously"+(this.isVoid ? "VoidBag" : "Bag"))); + ItemStack[] slots = new ItemStack[ContainerBag.getSlotAmount(this.isVoid)]; + ItemDrill.loadSlotsFromNBT(slots, stack); + + int slotsTotal = slots.length; + int slotsFilled = 0; + + for(ItemStack slotStack : slots){ + if(StackUtil.isValid(slotStack)){ + slotsFilled++; + } + } + + // don't count the filter 4 slots + slotsTotal = slotsTotal - 4; + + tooltip.add(TextFormatting.ITALIC.toString()+slotsFilled+"/"+slotsTotal+" filled slots"); } @SubscribeEvent