aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRime <81419447+Emirlol@users.noreply.github.com>2024-05-19 09:21:34 +0300
committerRime <81419447+Emirlol@users.noreply.github.com>2024-05-23 13:31:48 +0300
commit475be1aa49068ce46e46c112842f72f28e5e680b (patch)
tree3e4eae0efd6a07a02f1c13b09be475167c8fb869
parent8866c7af5555298a29bbc26675289529b15b7cee (diff)
downloadSkyblocker-475be1aa49068ce46e46c112842f72f28e5e680b.tar.gz
Skyblocker-475be1aa49068ce46e46c112842f72f28e5e680b.tar.bz2
Skyblocker-475be1aa49068ce46e46c112842f72f28e5e680b.zip
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
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java8
1 files 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<Text> lines) {
for (int i = 0; i < lines.size(); i++) {
- Text line = lines.get(i);
- if (line.getString().equals("-----------------")) {
+ List<Text> 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());
}
}