aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
diff options
context:
space:
mode:
authorNopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com>2024-04-27 06:23:28 +1000
committerGitHub <noreply@github.com>2024-04-26 22:23:28 +0200
commitb3ca5b1ffc698ede14d4e9d8ed2dc86711201de1 (patch)
treeb30f23c9745bfc66c721e7bfdb440a336142871a /src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
parentd3106bf41e099d329d9db330ab09e167519fce25 (diff)
downloadnotenoughupdates-b3ca5b1ffc698ede14d4e9d8ed2dc86711201de1.tar.gz
notenoughupdates-b3ca5b1ffc698ede14d4e9d8ed2dc86711201de1.tar.bz2
notenoughupdates-b3ca5b1ffc698ede14d4e9d8ed2dc86711201de1.zip
Fix Profile viewer issues with Turkish language (#1116)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
index 1da81605..f2b7b1c8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
@@ -72,6 +72,7 @@ import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Objects;
import java.util.Random;
import java.util.regex.Matcher;
@@ -116,7 +117,7 @@ public class GuiCustomHex extends Gui {
}
}
JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(
- (isUlt ? "ULTIMATE_" : "") + enchId.toUpperCase() + ";" + level);
+ (isUlt ? "ULTIMATE_" : "") + enchId.toUpperCase(Locale.ROOT) + ";" + level);
if (bazaarInfo != null && bazaarInfo.get("curr_buy") != null) {
this.price = bazaarInfo.get("curr_buy").getAsInt();
}
@@ -476,7 +477,7 @@ public class GuiCustomHex extends Gui {
if (enchantments != null) {
String enchId = Utils
.cleanColour(book.getDisplayName())
- .toLowerCase()
+ .toLowerCase(Locale.ROOT)
.replace(" ", "_")
.replace("-", "_")
.replaceAll("[^a-z_]", "");
@@ -493,7 +494,7 @@ public class GuiCustomHex extends Gui {
}
Matcher levelMatcher = ENCHANT_LEVEL_PATTERN.matcher(enchId);
if (levelMatcher.matches()) {
- enchLevel = Utils.parseRomanNumeral(levelMatcher.group(2).toUpperCase());
+ enchLevel = Utils.parseRomanNumeral(levelMatcher.group(2).toUpperCase(Locale.ROOT));
enchId = levelMatcher.group(1);
}
Enchantment enchantment = new Enchantment(slotIndex, name, enchId,
@@ -595,7 +596,7 @@ public class GuiCustomHex extends Gui {
if (enchantments != null) {
String enchId = Utils
.cleanColour(book.getDisplayName())
- .toLowerCase()
+ .toLowerCase(Locale.ROOT)
.replace(" ", "_")
.replace("-", "_")
.replaceAll("[^a-z_]", "");
@@ -604,7 +605,7 @@ public class GuiCustomHex extends Gui {
String name = Utils.cleanColour(book.getDisplayName());
if (searchField.getText().trim().isEmpty() ||
- name.toLowerCase().contains(searchField.getText().trim().toLowerCase())) {
+ name.toLowerCase(Locale.ROOT).contains(searchField.getText().trim().toLowerCase(Locale.ROOT))) {
if (name.equalsIgnoreCase("Bane of Arthropods")) {
name = "Bane of Arth.";
} else if (name.equalsIgnoreCase("Projectile Protection")) {
@@ -650,7 +651,7 @@ public class GuiCustomHex extends Gui {
Comparator<Enchantment> comparator = cfg.enchantingSolvers.enchantSorting == 0 ?
Comparator.comparingInt(e -> mult * e.xpCost) :
(c1, c2) -> mult *
- c1.enchId.toLowerCase().compareTo(c2.enchId.toLowerCase());
+ c1.enchId.toLowerCase(Locale.ROOT).compareTo(c2.enchId.toLowerCase(Locale.ROOT));
removable.sort(comparator);
applicable.sort(comparator);
}
@@ -798,7 +799,7 @@ public class GuiCustomHex extends Gui {
if (ea != null) {
NBTTagCompound enchantments = ea.getCompoundTag("enchantments");
if (enchantments != null) {
- String itemId = Utils.cleanColour(book.getDisplayName()).toUpperCase().replace(" ", "_").replace(
+ String itemId = Utils.cleanColour(book.getDisplayName()).toUpperCase(Locale.ROOT).replace(" ", "_").replace(
"-",
"_"
);
@@ -806,7 +807,7 @@ public class GuiCustomHex extends Gui {
if (itemId.equalsIgnoreCase("_")) continue;
if (itemId.equalsIgnoreCase("Item_Maxed_Out")) continue;
if (searchField.getText().trim().isEmpty() ||
- name.toLowerCase().contains(searchField.getText().trim().toLowerCase())) {
+ name.toLowerCase(Locale.ROOT).contains(searchField.getText().trim().toLowerCase(Locale.ROOT))) {
name = fixName(name);
/*if (playerEnchantIds.containsKey(itemId)) {
HexItem item = new HexItem(slotIndex, name, itemId,
@@ -966,7 +967,7 @@ public class GuiCustomHex extends Gui {
Comparator<HexItem> comparator = cfg.enchantingSolvers.enchantSorting == 0 ?
Comparator.comparingInt(e -> (int) (mult * e.price)) :
(c1, c2) -> mult *
- c1.itemId.toLowerCase().compareTo(c2.itemId.toLowerCase());
+ c1.itemId.toLowerCase(Locale.ROOT).compareTo(c2.itemId.toLowerCase(Locale.ROOT));
removableItem.sort(comparator);
applicableItem.sort(comparator);
}
@@ -1040,7 +1041,7 @@ public class GuiCustomHex extends Gui {
if (ea != null) {
NBTTagCompound enchantments = ea.getCompoundTag("enchantments");
if (enchantments != null) {
- String itemId = Utils.cleanColour(book.getDisplayName()).toUpperCase().replace(" ", "_").replace(
+ String itemId = Utils.cleanColour(book.getDisplayName()).toUpperCase(Locale.ROOT).replace(" ", "_").replace(
"-",
"_"
);
@@ -1048,7 +1049,7 @@ public class GuiCustomHex extends Gui {
if (itemId.equalsIgnoreCase("_")) continue;
if (itemId.equalsIgnoreCase("Item_Maxed_Out")) continue;
if (searchField.getText().trim().isEmpty() ||
- name.toLowerCase().contains(searchField.getText().trim().toLowerCase())) {
+ name.toLowerCase(Locale.ROOT).contains(searchField.getText().trim().toLowerCase(Locale.ROOT))) {
if (name.equalsIgnoreCase("Ultimate Enchantments")) {
name = "Ult Enchants";
}
@@ -1085,7 +1086,7 @@ public class GuiCustomHex extends Gui {
Comparator<HexItem> comparator = cfg.enchantingSolvers.enchantSorting == 0 ?
Comparator.comparingInt(e -> (int) (mult * e.price)) :
(c1, c2) -> mult *
- c1.itemId.toLowerCase().compareTo(c2.itemId.toLowerCase());
+ c1.itemId.toLowerCase(Locale.ROOT).compareTo(c2.itemId.toLowerCase(Locale.ROOT));
removableItem.sort(comparator);
applicableItem.sort(comparator);
}
@@ -1187,7 +1188,7 @@ public class GuiCustomHex extends Gui {
if (ea != null) {
NBTTagCompound enchantments = ea.getCompoundTag("enchantments");
if (enchantments != null) {
- String itemId = Utils.cleanColour(book.getDisplayName()).toUpperCase().replace(" ", "_").replace(
+ String itemId = Utils.cleanColour(book.getDisplayName()).toUpperCase(Locale.ROOT).replace(" ", "_").replace(
"-",
"_"
);
@@ -1195,7 +1196,7 @@ public class GuiCustomHex extends Gui {
if (itemId.equalsIgnoreCase("_")) continue;
if (itemId.equalsIgnoreCase("Item_Maxed_Out")) continue;
if (searchField.getText().trim().isEmpty() ||
- name.toLowerCase().contains(searchField.getText().trim().toLowerCase())) {
+ name.toLowerCase(Locale.ROOT).contains(searchField.getText().trim().toLowerCase(Locale.ROOT))) {
/*if (playerEnchantIds.containsKey(itemId)) {
HexItem item = new HexItem(slotIndex, name, itemId,
Utils.getRawTooltip(book), false, false
@@ -1247,7 +1248,7 @@ public class GuiCustomHex extends Gui {
Comparator<HexItem> comparator = cfg.enchantingSolvers.enchantSorting == 0 ?
Comparator.comparingInt(e -> (int) (mult * e.price)) :
(c1, c2) -> mult *
- c1.itemId.toLowerCase().compareTo(c2.itemId.toLowerCase());
+ c1.itemId.toLowerCase(Locale.ROOT).compareTo(c2.itemId.toLowerCase(Locale.ROOT));
removableItem.sort(comparator);
applicableItem.sort(comparator);
}