aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java81
1 files changed, 50 insertions, 31 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
index c4d06dd2..975e42ad 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
@@ -22,9 +22,9 @@ package io.github.moulberry.notenoughupdates.overlays;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
-import io.github.moulberry.notenoughupdates.miscgui.customtodos.CustomTodo;
import io.github.moulberry.notenoughupdates.miscgui.customtodos.CustomTodoHud;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
+import io.github.moulberry.notenoughupdates.util.ItemResolutionQuery;
import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
@@ -155,13 +155,39 @@ public class TimersOverlay extends TextTabOverlay {
return super.getSize(strings);
}
- private static final ItemStack PUZZLER_ICON = new ItemStack(Items.book);
private static ItemStack[] FETCHUR_ICONS = null;
- private static final ItemStack COMMISSIONS_ICON = new ItemStack(Items.iron_pickaxe);
- private static final ItemStack EXPERIMENTS_ICON = new ItemStack(Items.enchanted_book);
- private static final ItemStack RIFT_ICON = new ItemStack(Blocks.double_plant, 1, 1);
- private static final ItemStack QUEST_ICON = new ItemStack(Items.sign);
- private static final ItemStack SHOP_ICON = new ItemStack(Blocks.hopper);
+
+ private static HashMap<String, ItemStack> todoItems;
+
+ private static void setupTodoItems() {
+ todoItems = new HashMap<String, ItemStack>() {
+ {
+ addItem("Mithril Powder", "INK_SACK-10");
+ addItem("God Potion", "GOD_POTION_2");
+ addItem("Crimson Isle Quest", "SIGN");
+ addItem("Daily Shop Limit", "HOPPER");
+ addItem("Rift", "DOUBLE_PLANT-1");
+ addItem("Cakes", "EPOCH_CAKE_PINK");
+ addItem("Experiments", "ENCHANTED_BOOK");
+ addItem("Puzzler", "BOOK");
+ addItem("Commission", "IRON_PICKAXE");
+ addItem("Heavy Pearls", "HEAVY_PEARL");
+ addItem("Gemstone Powder", "PERFECT_AMETHYST_GEM");
+ addItem("Mithril Powder", "MITHRIL_ORE");
+ addItem("Cookie Buff", "BOOSTER_COOKIE");
+ }
+
+ private void addItem(String eventName, String internalName) {
+ ItemStack itemStack = new ItemResolutionQuery(NotEnoughUpdates.INSTANCE.manager)
+ .withKnownInternalName(internalName).resolveToItemStack();
+ if (itemStack == null) {
+ Utils.showOutdatedRepoNotification(internalName);
+ return;
+ }
+ put(eventName, itemStack.copy());
+ }
+ };
+ }
@Override
protected void renderLine(String line, Vector2f position, boolean dummy) {
@@ -171,6 +197,10 @@ public class TimersOverlay extends TextTabOverlay {
GlStateManager.enableDepth();
ItemStack icon = null;
+ if (todoItems == null) {
+ setupTodoItems();
+ }
+
String clean = Utils.cleanColour(line);
String beforeColon = clean.split(":")[0];
if (beforeColon.startsWith("CUSTOM")) {
@@ -178,17 +208,13 @@ public class TimersOverlay extends TextTabOverlay {
} else
switch (beforeColon) {
case "Cakes":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
- .getItemInformation()
- .get("EPOCH_CAKE_PINK"));
+ icon = todoItems.get("Cakes");
break;
case "Puzzler":
- icon = PUZZLER_ICON;
+ icon = todoItems.get("Puzzler");
break;
case "Godpot":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
- .getItemInformation()
- .get("GOD_POTION_2"));
+ icon = todoItems.get("God Potion");
break;
case "Fetchur": {
if (FETCHUR_ICONS == null) {
@@ -225,39 +251,31 @@ public class TimersOverlay extends TextTabOverlay {
break;
}
case "Commissions":
- icon = COMMISSIONS_ICON;
+ icon = todoItems.get("Commission");
break;
case "Experiments":
- icon = EXPERIMENTS_ICON;
+ icon = todoItems.get("Experiments");
break;
case "Cookie Buff":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
- .getItemInformation()
- .get("BOOSTER_COOKIE"));
+ icon = todoItems.get("Cookie Buff");
break;
case "Mithril Powder":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
- .getItemInformation()
- .get("MITHRIL_ORE"));
+ icon = todoItems.get("Mithril Powder");
break;
case "Gemstone Powder":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
- .getItemInformation()
- .get("PERFECT_AMETHYST_GEM"));
+ icon = todoItems.get("Gemstone Powder");
break;
case "Heavy Pearls":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
- .getItemInformation()
- .get("HEAVY_PEARL"));
+ icon = todoItems.get("Heavy Pearls");
break;
case "Free Rift Infusion":
- icon = RIFT_ICON;
+ icon = todoItems.get("Rift");
break;
case "Crimson Isle Quests":
- icon = QUEST_ICON;
+ icon = todoItems.get("Crimson Isle Quest");
break;
case "NPC Buy Daily Limit":
- icon = SHOP_ICON;
+ icon = todoItems.get("Daily Shop Limit");
break;
}
@@ -401,6 +419,7 @@ public class TimersOverlay extends TextTabOverlay {
switch (unit) {
case "Years":
case "Year":
+ case "y":
hidden.cookieBuffRemaining += val * 365 * 24 * 60 * 60 * 1000;
break;
case "Months":