aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoKM <54663875+DoKM@users.noreply.github.com>2021-09-25 17:05:34 +0200
committerGitHub <noreply@github.com>2021-09-25 17:05:34 +0200
commit369027f8c0b6eec54dafb2428653c5f8147f4aaa (patch)
treecc6cf1f16661b9ce97d426ec6beb581a397addcf
parente011c9a92bb9a8e056adbf9a0d42315348e55210 (diff)
parent1e434a53201374f7e459c336c3459220cc9f104e (diff)
downloadNotEnoughUpdates-369027f8c0b6eec54dafb2428653c5f8147f4aaa.tar.gz
NotEnoughUpdates-369027f8c0b6eec54dafb2428653c5f8147f4aaa.tar.bz2
NotEnoughUpdates-369027f8c0b6eec54dafb2428653c5f8147f4aaa.zip
Merge pull request #35 from Keebler408/locationSpecificData
Introduce location specific config, move commission maxes into it
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java18
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java12
2 files changed, 23 insertions, 7 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
index a789acfd..d4a078a9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -264,6 +264,8 @@ public class NEUConfig extends Config {
public static class Hidden {
@Expose
public HashMap<String, NEUConfig.HiddenProfileSpecific> profileSpecific = new HashMap<>();
+ @Expose
+ public HashMap<String, NEUConfig.HiddenLocationSpecific> locationSpecific = new HashMap<>();
@Expose public List<NEUConfig.InventoryButton> inventoryButtons = createDefaultInventoryButtons();
@Expose public boolean enableItemEditing = false;
@@ -284,7 +286,6 @@ public class NEUConfig extends Config {
@Expose public ArrayList<String> enchantColours = createDefaultEnchantColours();
@Expose public String repoURL = "https://github.com/Moulberry/NotEnoughUpdates-REPO/archive/master.zip";
@Expose public String repoCommitsURL = "https://api.github.com/repos/Moulberry/NotEnoughUpdates-REPO/commits/master";
- @Expose public Map<String, Integer> commissionMaxes = new HashMap<>();
@Expose public boolean firstTimeSearchFocus = true;
@@ -361,9 +362,20 @@ public class NEUConfig extends Config {
put("Sapphire", 0);
put("Topaz", 0);
}};
- }
+ }
+
+ public HiddenLocationSpecific getLocationSpecific() {
+ if(SBInfo.getInstance().location == null) {
+ return null;
+ }
+ return hidden.locationSpecific.computeIfAbsent(SBInfo.getInstance().getLocation(), k-> new HiddenLocationSpecific());
+ }
+
+ public static class HiddenLocationSpecific {
+ @Expose public Map<String, Integer> commissionMaxes = new HashMap<>();
+ }
- public static List<InventoryButton> createDefaultInventoryButtons() {
+ public static List<InventoryButton> createDefaultInventoryButtons() {
List<InventoryButton> buttons = new ArrayList<>();
//Below crafting
buttons.add(new InventoryButton(87, 63, null, true, false, false, 0, ""));
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
index 0beb8060..7a888191 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
@@ -79,8 +79,10 @@ public class MiningOverlay extends TextOverlay {
}
}
}
+
+ NEUConfig.HiddenLocationSpecific locationSpecific = NotEnoughUpdates.INSTANCE.config.getLocationSpecific();
if(name != null && numberValue > 0) {
- NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.put(name, numberValue);
+ locationSpecific.commissionMaxes.put(name, numberValue);
}
}
}
@@ -237,12 +239,13 @@ public class MiningOverlay extends TextOverlay {
String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info);
if (name.contains("Mithril Powder:")) {
mithrilPowder = DARK_AQUA + Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "");
+ continue;
}
if (name.contains("Gemstone Powder:")) {
gemstonePowder = DARK_AQUA + Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "");
+ continue;
}
-
if (name.matches("\\xa7r\\xa79\\xa7lForges \\xa7r(?:\\xa7f\\(\\+1 more\\)\\xa7r)?")) {
commissions = false;
forges = true;
@@ -343,8 +346,9 @@ public class MiningOverlay extends TextOverlay {
} else if (entry.getValue() >= 0.25) {
col = GOLD;
}
- if (NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.containsKey(entry.getKey())) {
- int max = NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.get(entry.getKey());
+ NEUConfig.HiddenLocationSpecific locationSpecific = NotEnoughUpdates.INSTANCE.config.getLocationSpecific();
+ int max;
+ if (-1 != (max = locationSpecific.commissionMaxes.getOrDefault(entry.getKey(), -1))) {
commissionsStrings.add(DARK_AQUA + entry.getKey() + ": " + col + Math.round(entry.getValue() * max) + "/" + max);
} else {
String valS = Utils.floatToString(entry.getValue() * 100, 1);