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
This commit is contained in:
Bruce Wang 2016-12-12 17:41:33 +11:00 committed by Ellpeck
parent cde6127fd1
commit 6844c44dcf

View file

@ -56,7 +56,22 @@ public class ItemBag extends ItemBase{
@Override
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> 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