Skip to content

Commit

Permalink
"Improved" tooltip
Browse files Browse the repository at this point in the history
percentages mean jack shit when they're almost always going to be 0%
code still sucks though
  • Loading branch information
62832 committed Jul 4, 2022
1 parent 257aa86 commit bf27e72
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/main/java/ninety/megacells/item/MEGABulkCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,21 @@ public void appendHoverText(ItemStack is, Level level, List<Component> lines, To
return;
}

double used = handler.getUsedBytes();
lines.add(used == 0 ? Tooltips.of("Empty")
: Tooltips.of(Tooltips.of("Capacity Used: "),
Tooltips.ofPercent(used / (double) Integer.MAX_VALUE, false)));

var containedType = handler.getAvailableStacks().getFirstKey();
if (containedType != null) {
var item = containedType.wrapForDisplayOrFilter();
lines.add(Tooltips.of(Tooltips.of("Contains: "), Tooltips.of(item.getHoverName())));
lines.add(containedType == null ? Tooltips.of("Empty")
: Tooltips.of(Tooltips.of("Contains: "),
Tooltips.of(containedType.wrapForDisplayOrFilter().getHoverName())));

var filterSlots = handler.getConfigInventory().keySet().stream().toList();
if (!filterSlots.isEmpty()) {
if (filterSlots.size() == 1) {
lines.add(Tooltips.of(Tooltips.of("Partitioned for: "), filterSlots.get(0).getDisplayName()));
} else {
lines.add(Tooltips.of("Partitioned for:"));
for (var slot : filterSlots) {
lines.add(slot.getDisplayName());
}
}
}
}

Expand Down

0 comments on commit bf27e72

Please sign in to comment.