Skip to content

Commit

Permalink
fix DarkSteel and other EIO items display (#7)
Browse files Browse the repository at this point in the history
Co-authored-by: ghostflyby <[email protected]>
  • Loading branch information
ghostflyby and ghostflyby authored Aug 3, 2023
1 parent 5e0a4a2 commit 078b590
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,25 @@ private static List<ItemStackOverlay> handleEnergyContainer(@NotNull ItemStack s

// handles all other EIO items
private static List<ItemStackOverlay> handleDarkSteelItems(@NotNull ItemStack stack) {

Item item = stack.getItem();
assert item != null;

List<ItemStackOverlay> overlays = new ArrayList<>();
List<ItemStackOverlay> defaultOverlays = handleDefault(stack);
if (defaultOverlays != null) {
overlays.addAll(defaultOverlays);

if (DuraDisplayConfig.DurabilityConfig.Enabled
&& !(DuraDisplayConfig.DurabilityConfig.ShowWhenFull && (stack.getItemDamage() == stack.getMaxDamage()))) {

ItemStackOverlay durabilityOverlay = new ItemStackOverlay.DurabilityOverlay();
double durability = (1 - item.getDurabilityForDisplay(stack));
if (Double.isNaN(durability)) return null;
durabilityOverlay.color = getRGBDurabilityForDisplay(durability);
durability *= 100;
durabilityOverlay.isFull = durability == 100.0;
durabilityOverlay.value = nf.format(durability) + "%";
overlays.add(durabilityOverlay);
}

if (!DuraDisplayConfig.ChargeConfig.Enabled || !stack.hasTagCompound()) return overlays;

NBTTagCompound nbt = stack.getTagCompound();
Expand Down

0 comments on commit 078b590

Please sign in to comment.