From 475be1aa49068ce46e46c112842f72f28e5e680b Mon Sep 17 00:00:00 2001 From: Rime <81419447+Emirlol@users.noreply.github.com> Date: Sun, 19 May 2024 09:21:34 +0300 Subject: Narrow the scope of the line smoother in ItemTooltip Not necessarily related to the chocolate factory, but it was also added by me so should be fine --- .../de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java index 6e269790..70586d89 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java @@ -394,10 +394,14 @@ public class ItemTooltip { return message; } + //This is static to not create a new text object for each line in every item + private static final Text bumpyLine = Text.literal("-----------------").formatted(Formatting.DARK_GRAY, Formatting.STRIKETHROUGH); + private static void smoothenLines(List lines) { for (int i = 0; i < lines.size(); i++) { - Text line = lines.get(i); - if (line.getString().equals("-----------------")) { + List lineSiblings = lines.get(i).getSiblings(); + //Compare the first sibling rather than the whole object as the style of the root object can change while visually staying the same + if (lineSiblings.size() == 1 && lineSiblings.getFirst().equals(bumpyLine)) { lines.set(i, createSmoothLine()); } } -- cgit