aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorDoKM <mcazzyman@gmail.com>2021-09-24 19:34:54 +0200
committerDoKM <mcazzyman@gmail.com>2021-09-24 19:34:54 +0200
commit8ddbfb076daed44d9eac635882f9b7a0a0642e97 (patch)
treedf9661c2bd61c7187b679f3eea884f8df843ed06 /src/main/java/io
parentce47182fa85c484aba6266ff7548b4e8c3fbfe08 (diff)
downloadNotEnoughUpdates-8ddbfb076daed44d9eac635882f9b7a0a0642e97.tar.gz
NotEnoughUpdates-8ddbfb076daed44d9eac635882f9b7a0a0642e97.tar.bz2
NotEnoughUpdates-8ddbfb076daed44d9eac635882f9b7a0a0642e97.zip
Fix neuec v2
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 212bb8a4..9344649f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -2071,13 +2071,14 @@ public class NEUEventListener {
//9([a-zA-Z ]+?) ([0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X))(,|$)
Pattern pattern;
try {
- pattern = Pattern.compile("(\\u00A79|\\u00A79\\u00A7d\\u00A7l)("+enchantName+") " +
+ pattern = Pattern.compile("(\\u00A79|\\u00A7(9|l)\\u00A7d\\u00A7l)(?<enchantName>"+enchantName+") " +
"(?<level>[0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X|XI|XII|XIII|XIV|XV|XVI|XVII|XVIII|XIX|XX))((\\u00A79)?,|( \\u00A78(?:,?[0-9]+)*)?$)");
} catch(Exception e) {continue;} //malformed regex
Matcher matcher = pattern.matcher(line);
int matchCount = 0;
while(matcher.find() && matchCount < 5) {
- if(Utils.cleanColour(matcher.group(2)).startsWith(" ")) continue;
+ if(Utils.cleanColour(matcher.group("enchantName")).startsWith(" ")) continue;
+
matchCount++;
int level = -1;
@@ -2141,7 +2142,7 @@ public class NEUEventListener {
}
}
if(matches) {
- String enchantText = matcher.group(2);
+ String enchantText = matcher.group("enchantName");
StringBuilder extraModifiersBuilder = new StringBuilder();
if((modifierI & GuiEnchantColour.BOLD_MODIFIER) != 0) {
@@ -2167,6 +2168,8 @@ public class NEUEventListener {
"\u00A7"+colourCode+extraMods+enchantText);
line = line.replace("\u00A79\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+".*", ""));
@@ -2176,6 +2179,10 @@ public class NEUEventListener {
"\\u00A79\\u00A7d\\u00A7l"+enchantText+".*", ""));
line = line.replace("\u00A79\u00A7d\u00A7l"+enchantText, Utils.chromaString(enchantText,
offset/12f+index, true));
+ offset = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line.replaceAll(
+ "\\u00A7l\\u00A7d\\u00A7l"+enchantText+".*", ""));
+ line = line.replace("\u00A7l\u00A7d\u00A7l"+enchantText, Utils.chromaString(enchantText,
+ offset/12f+index, true));
}
}
}