From 29fef122c10a2847494e293c3c881002dca9a8ff Mon Sep 17 00:00:00 2001 From: ghostflyby Date: Mon, 1 Apr 2024 17:16:51 +0800 Subject: [PATCH] Fix showing unnecessary info on some items --- .../com/caedis/duradisplay/overlay/OverlayDurabilityLike.java | 3 ++- .../java/com/caedis/duradisplay/utils/DurabilityLikeInfo.java | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/caedis/duradisplay/overlay/OverlayDurabilityLike.java b/src/main/java/com/caedis/duradisplay/overlay/OverlayDurabilityLike.java index 764398d..9845fa9 100644 --- a/src/main/java/com/caedis/duradisplay/overlay/OverlayDurabilityLike.java +++ b/src/main/java/com/caedis/duradisplay/overlay/OverlayDurabilityLike.java @@ -62,9 +62,10 @@ protected final void addHandler(@NotNull String className, if (info != null) { return info; } + return DurabilityLikeInfo.empty; } } - return new DurabilityLikeInfo(0, 0); + return DurabilityLikeInfo.empty; } protected int getColor(DurabilityLikeInfo info) { diff --git a/src/main/java/com/caedis/duradisplay/utils/DurabilityLikeInfo.java b/src/main/java/com/caedis/duradisplay/utils/DurabilityLikeInfo.java index d746c68..d9c5424 100644 --- a/src/main/java/com/caedis/duradisplay/utils/DurabilityLikeInfo.java +++ b/src/main/java/com/caedis/duradisplay/utils/DurabilityLikeInfo.java @@ -12,6 +12,8 @@ public DurabilityLikeInfo(double current, double max) { this.max = max; } + public static final DurabilityLikeInfo empty = new DurabilityLikeInfo(0, 0); + public boolean isFull() { return current != 0 && current == max; }