aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorNopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com>2022-09-14 22:31:40 +1000
committerGitHub <noreply@github.com>2022-09-14 14:31:40 +0200
commit12fdc80608962c0ae70e0deb246076c1d40f7d8a (patch)
tree6c11eb84b5472e9d6e9bb49005aaddbd084ee465 /src/main/java/io
parentc0eee7a5df9239a361d5e6363a172abe32fd0e84 (diff)
downloadNotEnoughUpdates-12fdc80608962c0ae70e0deb246076c1d40f7d8a.tar.gz
NotEnoughUpdates-12fdc80608962c0ae70e0deb246076c1d40f7d8a.tar.bz2
NotEnoughUpdates-12fdc80608962c0ae70e0deb246076c1d40f7d8a.zip
fix 9 and b getting overridden (#276)
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java
index 5d6a2bdc..c522e70a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java
@@ -382,6 +382,7 @@ public class ItemTooltipListener {
}
}
if (hasEnchantments || hasAttributes) {
+ ArrayList<String> addedEnchants = new ArrayList<>();
for (String op : NotEnoughUpdates.INSTANCE.config.hidden.enchantColours) {
List<String> colourOps = GuiEnchantColour.splitter.splitToList(op);
String enchantName = GuiEnchantColour.getColourOpIndex(colourOps, 0);
@@ -475,20 +476,22 @@ public class ItemTooltipListener {
String extraMods = extraModifiersBuilder.toString();
if (!colourCode.equals("z")) {
- line = line.replace("\u00A79" + enchantText, "\u00A7" + colourCode + extraMods + enchantText);
- line = line.replace("\u00A7b" + enchantText, "\u00A7" + colourCode + extraMods + enchantText);
- line = line.replace(
- "\u00A79\u00A7d\u00A7l" + enchantText,
- "\u00A7" + colourCode + extraMods + enchantText
- );
- line = line.replace(
- "\u00A7b\u00A7d\u00A7l" + enchantText,
- "\u00A7" + colourCode + extraMods + enchantText
- );
- line = line.replace(
- "\u00A7l\u00A7d\u00A7l" + enchantText,
- "\u00A7" + colourCode + extraMods + enchantText
- );
+ if (!addedEnchants.contains(enchantText)) {
+ line = line.replace("\u00A79" + enchantText, "\u00A7" + colourCode + extraMods + enchantText);
+ line = line.replace("\u00A7b" + enchantText, "\u00A7" + colourCode + extraMods + enchantText);
+ line = line.replace(
+ "\u00A79\u00A7d\u00A7l" + enchantText,
+ "\u00A7" + colourCode + extraMods + enchantText
+ );
+ line = line.replace(
+ "\u00A7b\u00A7d\u00A7l" + enchantText,
+ "\u00A7" + colourCode + extraMods + enchantText
+ );
+ line = line.replace(
+ "\u00A7l\u00A7d\u00A7l" + enchantText,
+ "\u00A7" + colourCode + extraMods + enchantText
+ );
+ }
} else {
int offset = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line.replaceAll(
"\\u00A79" + enchantText + ".*",
@@ -516,6 +519,7 @@ public class ItemTooltipListener {
Utils.chromaString(enchantText, offset / 12f + index, true)
);
}
+ addedEnchants.add(enchantText);
}
}
}