aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoKM <54663875+DoKM@users.noreply.github.com>2021-08-24 15:49:53 +0200
committerGitHub <noreply@github.com>2021-08-24 15:49:53 +0200
commit541810f238fa49808722235596a38227d995d8fa (patch)
tree897d81d084a3d5339d7e0793bb8bf88e44ad691c
parente9f5c3c4547fd83fbfbfd64d4bf0437a7c0b0969 (diff)
parent5fa06410754c7c69ec4690a3f12883f4e2db93d6 (diff)
downloadNotEnoughUpdates-541810f238fa49808722235596a38227d995d8fa.tar.gz
NotEnoughUpdates-541810f238fa49808722235596a38227d995d8fa.tar.bz2
NotEnoughUpdates-541810f238fa49808722235596a38227d995d8fa.zip
Merge pull request #26 from DeDiamondPro/master
Crystal hollow overlay
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java51
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java225
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java166
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java403
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java142
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java69
7 files changed, 597 insertions, 467 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index fbf51fca..4f3b6187 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -835,10 +835,10 @@ public class NEUEventListener {
if (unformatted.startsWith("You found ") && SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows")){
CrystalMetalDetectorSolver.reset();
}
- if(unformatted.startsWith("[NPC] Professor Robot: ") || unformatted.startsWith(" "))
- OverlayManager.automatonOverlay.message(unformatted);
- else if(unformatted.startsWith("[NPC] Keeper of "))
- OverlayManager.divanMinesOverlay.message(unformatted);
+ if(unformatted.startsWith("[NPC] Keeper of ") | unformatted.startsWith("[NPC] Professor Robot: ") || unformatted.startsWith(" ") || unformatted.startsWith("✦") ||
+ unformatted.equals(" You've earned a Crystal Loot Bundle!"))
+ OverlayManager.crystalHollowOverlay.message(unformatted);
+ System.out.println(unformatted);
}
public static boolean drawingGuiScreen = false;
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 cbf92fb2..22d3f6ff 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -6,13 +6,15 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
import io.github.moulberry.notenoughupdates.core.config.Config;
import io.github.moulberry.notenoughupdates.core.config.Position;
-import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+import io.github.moulberry.notenoughupdates.core.config.annotations.Category;
import io.github.moulberry.notenoughupdates.core.config.gui.GuiPositionEditor;
import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour;
import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor;
import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements;
import io.github.moulberry.notenoughupdates.options.seperateSections.*;
-import io.github.moulberry.notenoughupdates.overlays.*;
+import io.github.moulberry.notenoughupdates.overlays.MiningOverlay;
+import io.github.moulberry.notenoughupdates.overlays.OverlayManager;
+import io.github.moulberry.notenoughupdates.overlays.TextOverlay;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import net.minecraft.client.Minecraft;
import net.minecraftforge.client.ClientCommandHandler;
@@ -86,10 +88,7 @@ public class NEUConfig extends Config {
editOverlay(activeConfigCategory, OverlayManager.bonemerangOverlay, itemOverlays.bonemerangPosition);
return;
case 10:
- editOverlay(activeConfigCategory, OverlayManager.automatonOverlay, mining.automatonOverlayPosition);
- return;
- case 11:
- editOverlay(activeConfigCategory, OverlayManager.divanMinesOverlay, mining.divanMinesOverlayPosition);
+ editOverlay(activeConfigCategory, OverlayManager.crystalHollowOverlay, mining.crystalHollowOverlayPosition);
}
}
@@ -339,23 +338,29 @@ public class NEUConfig extends Config {
@Expose public int commissionMilestone = 0;
- @Expose public HashMap<String, Boolean> automatonParts = new HashMap<>();
-
- @Expose public HashMap<String, Boolean> divanMinesParts = new HashMap<>();
-
- public HiddenProfileSpecific(){
- automatonParts.putIfAbsent("Electron Transmitter", false);
- automatonParts.putIfAbsent("FTX 3070", false);
- automatonParts.putIfAbsent("Robotron Reflector", false);
- automatonParts.putIfAbsent("Superlite Motor", false);
- automatonParts.putIfAbsent("Control Switch", false);
- automatonParts.putIfAbsent("Synthetic Heart", false);
-
- divanMinesParts.putIfAbsent("Scavenged Lapis Sword", false);
- divanMinesParts.putIfAbsent("Scavenged Golden Hammer", false);
- divanMinesParts.putIfAbsent("Scavenged Diamond Axe", false);
- divanMinesParts.putIfAbsent("Scavenged Emerald Hammer", false);
- }
+ @Expose public HashMap<String, Boolean> automatonParts = new HashMap<String, Boolean>(){{
+ put("Electron Transmitter", false);
+ put("FTX 3070", false);
+ put("Robotron Reflector", false);
+ put("Superlite Motor", false);
+ put("Control Switch", false);
+ put("Synthetic Heart", false);
+ }};
+
+ @Expose public HashMap<String, Boolean> divanMinesParts = new HashMap<String, Boolean>(){{
+ put("Scavenged Lapis Sword", false);
+ put("Scavenged Golden Hammer", false);
+ put("Scavenged Diamond Axe", false);
+ put("Scavenged Emerald Hammer", false);
+ }};
+
+ @Expose public HashMap<String, Integer> crystals = new HashMap<String, Integer>(){{
+ put("Jade", 0);
+ put("Amber", 0);
+ put("Amethyst", 0);
+ put("Sapphire", 0);
+ put("Topaz", 0);
+ }};
}
public static List<InventoryButton> createDefaultInventoryButtons() {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java
index af0eab2e..a80e587d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java
@@ -189,43 +189,88 @@ public class Mining {
public boolean metalDetectorShowPossible = false;
@ConfigOption(
- name = "Automaton Parts Overlay",
+ name = "Crystal Hollows Overlay",
desc = ""
)
@ConfigEditorAccordion(id = 4)
- public boolean automatonOverlayAccordion = false;
+ public boolean crystalHollowOverlayAccordion = false;
@Expose
@ConfigOption(
name = "Enable Overlay",
- desc = "Enables the Automaton parts Overlay."
+ desc = "Enables the Crystal Hollows Overlay."
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 4)
- public boolean automatonOverlay = false;
+ public boolean crystalHollowOverlay = true;
@Expose
@ConfigOption(
name = "Overlay Position",
- desc = "Change the position of the Automaton parts Overlay."
+ desc = "Change the position of the Crystal Hollows Overlay."
)
@ConfigEditorButton(
runnableId = 10,
buttonText = "Edit"
)
@ConfigAccordionId(id = 4)
- public Position automatonOverlayPosition = new Position(200, 0);
+ public Position crystalHollowOverlayPosition = new Position(200, 0);
+
+ @Expose
+ @ConfigOption(
+ name = "Options",
+ desc = "Drag text to change the appearance of the overlay!\n" +
+ "Click add to add extra things!"
+ )
+ @ConfigEditorDraggableList(
+ exampleText = {
+ "\u00a73Amber Crystal: \u00a7aPlaced\n" +
+ "\u00a73Sapphire Crystal: \u00a7eCollected\n" +
+ "\u00a73Jade Crystal: \u00a7eMissing\n" +
+ "\u00a73Amethyst Crystal: \u00a7cMissing\n" +
+ "\u00a73Topaz Crystal: \u00a7cMissing\n",
+ "\u00a73Crystals: \u00a7a4/5",
+ "\u00a73Crystals: \u00a7a80%",
+ "\u00a73Electron Transmitter: \u00a7aDone\n" +
+ "\u00a73Robotron Reflector: \u00a7eIn Storage\n" +
+ "\u00a73Superlite Motor: \u00a7eIn Inventory\n" +
+ "\u00a73Synthetic Hearth: \u00a7cMissing\n" +
+ "\u00a73Control Switch: \u00a7cMissing\n" +
+ "\u00a73FTX 3070: \u00a7cMissing",
+ "\u00a73Electron Transmitter: \u00a7a3\n" +
+ "\u00a73Robotron Reflector: \u00a7e2\n" +
+ "\u00a73Superlite Motor: \u00a7e1\n" +
+ "\u00a73Synthetic Hearth: \u00a7c0\n" +
+ "\u00a73Control Switch: \u00a7c0\n" +
+ "\u00a73FTX 3070: \u00a7c0",
+ "\u00a73Automaton parts: \u00a7a5/6",
+ "\u00a73Automaton parts: \u00a7a83%",
+ "\u00a73Scavenged Lapis Sword: \u00a7aDone\n" +
+ "\u00a73Scavenged Golden Hammer: \u00a7eIn Storage\n" +
+ "\u00a73Scavenged Diamond Axe: \u00a7eIn Inventory\n" +
+ "\u00a73Scavenged Emerald Hammer: \u00a7cMissing\n",
+ "\u00a73Scavenged Lapis Sword: \u00a7a3\n" +
+ "\u00a73Scavenged Golden Hammer: \u00a7e2\n" +
+ "\u00a73Scavenged Diamond Axe: \u00a7e1\n" +
+ "\u00a73Scavenged Emerald Hammer: \u00a7c0\n",
+ "\u00a73Mines of Divan parts: \u00a7a3/4",
+ "\u00a73Mines of Divan parts: \u00a7a75%"
+ }
+ )
+ @ConfigAccordionId(id = 4)
+ public List<Integer> crystalHollowText = new ArrayList<>(Arrays.asList(0, 3, 7));
@Expose
@ConfigOption(
name = "Style",
- desc = "Change the style of the Automaton parts Overlay."
+ desc = "Change the style of the Crystal Hollows Overlay."
)
@ConfigEditorDropdown(
values = {"Background", "No Shadow", "Shadow", "Full Shadow"}
)
@ConfigAccordionId(id = 4)
- public int automatonOverlayStyle = 0;
+ public int crystalHollowOverlayStyle = 0;
+
@Expose
@ConfigOption(
@@ -234,211 +279,179 @@ public class Mining {
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 4)
- public boolean automatonIcons = true;
+ public boolean crystalHollowIcons = true;
@Expose
@ConfigOption(
name = "Hide Done",
- desc = "Don't show parts you've given to Professor Robot."
+ desc = "Don't show parts you've given to the NPC."
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 4)
- public boolean automatonHideDone = false;
+ public boolean crystalHollowHideDone = false;
@ConfigOption(
- name = "Colours",
+ name = "Locations",
desc = ""
)
@ConfigEditorAccordion(id = 5)
@ConfigAccordionId(id = 4)
- public boolean AutomatonColourAccordion = false;
+ public boolean crystalHollowLocationAccordion = false;
@Expose
@ConfigOption(
- name = "Part colour",
- desc = "Change the colour of the part text."
-
+ name = "Show Automaton",
+ desc = "Change where to show Automaton parts."
)
@ConfigEditorDropdown(
- values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ values = {"Crystal Hollows", "Precursor Remnants", "Lost Precursor City"}
)
@ConfigAccordionId(id = 5)
- public int automatonPartColor = 3;
+ public int crystalHollowAutomatonLocation = 2;
@Expose
@ConfigOption(
- name = "Ready colour",
- desc = "Change the colour when the part is given to Professor Robot."
-
+ name = "Show Divan",
+ desc = "Change where to show Mines of Divan parts."
)
@ConfigEditorDropdown(
- values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ values = {"Crystal Hollows", "Mithril Deposits", "Mines of Divan"}
)
@ConfigAccordionId(id = 5)
- public int automatonDoneColor = 10;
+ public int crystalHollowDivanLocation = 2;
@Expose
@ConfigOption(
- name = "In Inventory Color",
- desc = "Change the colour when the part is in the inventory."
-
+ name = "Show Crystal",
+ desc = "Change where to show Collected Crystals."
)
@ConfigEditorDropdown(
- values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
+ values = {"Crystal Hollows", "When No Other Overlays"}
)
@ConfigAccordionId(id = 5)
- public int automatonInventoryColor = 14;
+ public int crystalHollowCrystalLocation = 1;
+
+ @ConfigOption(
+ name = "Colours",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 6)
+ @ConfigAccordionId(id = 4)
+ public boolean crystalHollowColourAccordion = false;
@Expose
@ConfigOption(
- name = "In Storage Color",
- desc = "Change the colour when the part is in the storage."
+ name = "Main Color",
+ desc = "Change the main color of the overlay."
)
@ConfigEditorDropdown(
values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
)
- @ConfigAccordionId(id = 5)
- public int automatonStorageColor = 14;
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowPartColor = 3;
@Expose
@ConfigOption(
- name = "Missing Color",
- desc = "Change the colour when the part is missing."
+ name = "Done Color",
+ desc = "Change the colour when the part is given to the NPC."
)
@ConfigEditorDropdown(
values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
)
- @ConfigAccordionId(id = 5)
- public int automatonMissingColor = 12;
-
- @ConfigOption(
- name = "Mines of Divan Overlay",
- desc = ""
- )
- @ConfigEditorAccordion(id = 6)
- public boolean divanMinesOverlayAccordion = false;
- @Expose
- @ConfigOption(
- name = "Enable Overlay",
- desc = "Enables the Mines of Divan Overlay."
- )
- @ConfigEditorBoolean
@ConfigAccordionId(id = 6)
- public boolean divanMinesOverlay = false;
+ public int crystalHollowDoneColor = 10;
@Expose
@ConfigOption(
- name = "Overlay Position",
- desc = "Change the position of the Mines of Divan Overlay."
+ name = "In Inventory Color",
+ desc = "Change the colour when the part is in the inventory."
)
- @ConfigEditorButton(
- runnableId = 11,
- buttonText = "Edit"
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
)
@ConfigAccordionId(id = 6)
- public Position divanMinesOverlayPosition = new Position(200, 0);
+ public int crystalHollowInventoryColor = 14;
@Expose
@ConfigOption(
- name = "Style",
- desc = "Change the style of the Mines of Divan Overlay."
+ name = "In Storage Color",
+ desc = "Change the colour when the part is in the storage."
)
@ConfigEditorDropdown(
- values = {"Background", "No Shadow", "Shadow", "Full Shadow"}
- )
- @ConfigAccordionId(id = 6)
- public int divanMinesOverlayStyle = 0;
-
- @Expose
- @ConfigOption(
- name = "Show Icons",
- desc = "Show icons in the Overlay that represent the part."
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
)
- @ConfigEditorBoolean
@ConfigAccordionId(id = 6)
- public boolean divanMinesIcons = true;
-
+ public int crystalHollowStorageColor = 14;
@Expose
@ConfigOption(
- name = "Hide Done",
- desc = "Don't show parts you've given to the Keepers."
+ name = "Missing Color",
+ desc = "Change the colour when the part is missing."
)
- @ConfigEditorBoolean
- @ConfigAccordionId(id = 6)
- public boolean divanMinesHideDone = false;
-
- @ConfigOption(
- name = "Colours",
- desc = ""
+ @ConfigEditorDropdown(
+ values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
)
- @ConfigEditorAccordion(id = 7)
@ConfigAccordionId(id = 6)
- public boolean divanMinesColourAccordion = false;
+ public int crystalHollowMissingColor = 12;
@Expose
@ConfigOption(
- name = "Part colour",
- desc = "Change the colour of the part text."
-
+ name = "Placed Color",
+ desc = "Change the colour when the crystal is placed."
)
@ConfigEditorDropdown(
values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
)
- @ConfigAccordionId(id = 7)
- public int divanMinesPartColor = 3;
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowPlacedColor = 10;
@Expose
@ConfigOption(
- name = "Ready colour",
- desc = "Change the colour when the part is given to the Keepers."
-
+ name = "Collected Color",
+ desc = "Change the colour when the crystal is collected"
)
@ConfigEditorDropdown(
values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
)
- @ConfigAccordionId(id = 7)
- public int divanMinesDoneColor = 10;
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowCollectedColor = 14;
@Expose
@ConfigOption(
- name = "In Inventory Color",
- desc = "Change the colour when the part is in the inventory."
-
+ name = "All Color",
+ desc = "Change the colour when you have 2/3-all of the parts collected in the count overlay."
)
@ConfigEditorDropdown(
values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
)
- @ConfigAccordionId(id = 7)
- public int divanMinesInventoryColor = 14;
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowAllColor = 10;
@Expose
@ConfigOption(
- name = "In Storage Color",
- desc = "Change the colour when the part is in the storage."
-
+ name = "1/3 Color",
+ desc = "Change the colour when you have 1/3-2/3 of the parts collected in the count overlay."
)
@ConfigEditorDropdown(
values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
)
- @ConfigAccordionId(id = 7)
- public int divanMinesStorageColor = 14;
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowMiddleColor = 14;
@Expose
@ConfigOption(
- name = "Missing Color",
- desc = "Change the colour when the part is missing."
-
+ name = "0 Color",
+ desc = "Change the colour when you have 0-1/3 of the parts collected in the count overlay."
)
@ConfigEditorDropdown(
values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"}
)
- @ConfigAccordionId(id = 7)
- public int divanMinesMissingColor = 12;
+ @ConfigAccordionId(id = 6)
+ public int crystalHollowNoneColor = 12;
@Expose
@ConfigOption(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java
deleted file mode 100644
index a0ef88b8..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java
+++ /dev/null
@@ -1,166 +0,0 @@
-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.miscfeatures.StorageManager;
-import io.github.moulberry.notenoughupdates.options.NEUConfig;
-import io.github.moulberry.notenoughupdates.util.SBInfo;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import org.lwjgl.util.vector.Vector2f;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Supplier;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class AutomatonOverlay extends TextOverlay {
- private static final Minecraft mc = Minecraft.getMinecraft();
- private final StorageManager storageManager = StorageManager.getInstance();
- private final Pattern givePattern = Pattern.compile("\\[NPC] Professor Robot: Thanks for bringing me the (?<part>[a-zA-Z0-9 ]+)! Bring me (\\d+|one) more components? to fix the giant!");
- private final Pattern notFinalPattern = Pattern.compile("\\[NPC] Professor Robot: That's not the final component! Bring me a (?<part>[a-zA-Z0-9 ]+) to gain access to Automaton Prime's storage container!");
-
- public AutomatonOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> styleSupplier) {
- super(position, dummyStrings, styleSupplier);
- }
-
- @Override
- public void update() {
- overlayStrings = null;
- if (!NotEnoughUpdates.INSTANCE.config.mining.automatonOverlay || SBInfo.getInstance().getLocation() == null ||
- !SBInfo.getInstance().getLocation().equals("crystal_hollows") || !SBInfo.getInstance().location.equals("Lost Precursor City"))
- return;
-
- NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific();
- if (hidden == null) return;
- overlayStrings = new ArrayList<>();
- HashMap<String, String> states = new HashMap<>();
- for (String key : hidden.automatonParts.keySet()) {
- Boolean has = hidden.automatonParts.get(key);
- if (has)
- states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonDoneColor] + "Done");
- }
- for (ItemStack item : mc.thePlayer.inventory.mainInventory) {
- if (item != null) {
- String name = Utils.cleanColour(item.getDisplayName());
- if (!states.containsKey(name)) {
- states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonInventoryColor] + "In Inventory");
- }
- }
- }
- for (Map.Entry<Integer, Integer> entry : storageManager.storageConfig.displayToStorageIdMap.entrySet()) {
- int storageId = entry.getValue();
- StorageManager.StoragePage page = storageManager.getPage(storageId, false);
- if (page != null && page.rows > 0) {
- for (ItemStack item : page.items) {
- if (item != null) {
- String name = Utils.cleanColour(item.getDisplayName());
- if (!states.containsKey(name)) {
- states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonStorageColor] + "In Storage");
- }
- }
- }
- }
- }
- for (String key : hidden.automatonParts.keySet()) {
- if (!NotEnoughUpdates.INSTANCE.config.mining.automatonHideDone || !hidden.automatonParts.get(key)) {
- if (!states.containsKey(key))
- states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonMissingColor] + "Missing");
- overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonPartColor] + key + ": " + states.get(key));
- }
- }
- }
-
- public void message(String message) {
- NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific();
- if (hidden == null) return;
- if (message.startsWith(" ")) {
- String item = message.replace(" ", "");
- if (hidden.automatonParts.containsKey(item)) {
- hidden.automatonParts.put(item, false);
- }
- } else if (message.startsWith("[NPC] Professor Robot: ")) {
- switch (message) {
- case "[NPC] Professor Robot: That's not one of the components I need! Bring me one of the missing components:":
- hidden.automatonParts.replaceAll((k, v) -> true);
- break;
- case "[NPC] Professor Robot: You've brought me all of the components!":
- case "[NPC] Professor Robot: You haven't placed the Sapphire Crystal yet!":
- case "[NPC] Professor Robot: You have already placed the Sapphire Crystal!":
- hidden.automatonParts.replaceAll((k, v) -> false);
- break;
- default:
- Matcher giveMatcher = givePattern.matcher(message);
- Matcher notFinalMatcher = notFinalPattern.matcher(message);
- if (giveMatcher.matches()) {
- String item = giveMatcher.group("part");
- if (hidden.automatonParts.containsKey(item)) {
- hidden.automatonParts.put(item, true);
- }
- } else if (notFinalMatcher.matches()) {
- String item = notFinalMatcher.group("part");
- if (hidden.automatonParts.containsKey(item)) {
- hidden.automatonParts.replaceAll((k, v) -> true);
- hidden.automatonParts.put(item, false);
- }
- }
- break;
- }
- }
- }
-
- @Override
- protected void renderLine(String line, Vector2f position, boolean dummy) {
- if (!NotEnoughUpdates.INSTANCE.config.mining.automatonIcons) return;
- GlStateManager.enableDepth();
-
- ItemStack icon = null;
- String cleaned = Utils.cleanColour(line);
- String beforeColon = cleaned.split(":")[0];
- switch (beforeColon) {
- case "Electron Transmitter":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ELECTRON_TRANSMITTER"));
- break;
- case "FTX 3070":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("FTX_3070"));
- break;
- case "Robotron Reflector":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ROBOTRON_REFLECTOR"));
- break;
- case "Superlite Motor":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SUPERLITE_MOTOR"));
- break;
- case "Control Switch":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("CONTROL_SWITCH"));
- break;
- case "Synthetic Heart":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SYNTHETIC_HEART"));
- break;
- }
-
- if (icon != null) {
- GlStateManager.pushMatrix();
- GlStateManager.translate(position.x - 2, position.y - 2, 0);
- GlStateManager.scale(0.7f, 0.7f, 1f);
- Utils.drawItemStack(icon, 0, 0);
- GlStateManager.popMatrix();
-
- position.x += 12;
- }
-
- super.renderLine(line, position, dummy);
- }
-
- @Override
- protected Vector2f getSize(List<String> strings) {
- if (NotEnoughUpdates.INSTANCE.config.mining.automatonIcons)
- return super.getSize(strings).translate(12, 0);
- return super.getSize(strings);
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java
new file mode 100644
index 00000000..f3dfa242
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java
@@ -0,0 +1,403 @@
+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.miscfeatures.StorageManager;
+import io.github.moulberry.notenoughupdates.options.NEUConfig;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import org.lwjgl.util.vector.Vector2f;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Supplier;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class CrystalHollowOverlay extends TextOverlay {
+ private static final Minecraft mc = Minecraft.getMinecraft();
+ private final StorageManager storageManager = StorageManager.getInstance();
+ private final Pattern notFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Talk to me when you have found a (?<item>[a-z-A-Z ]+)!");
+ private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Excellent! You have returned the (?<item>[a-z-A-Z ]+) to its rightful place!");
+ private final Pattern resetPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (You found all of the items! Behold\\.\\.\\. the Jade Crystal!)");
+ private final Pattern alreadyFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: You have already restored this Dwarf's (?<item>[a-z-A-Z ]+)!");
+ private final Pattern givePattern = Pattern.compile("\\[NPC] Professor Robot: Thanks for bringing me the (?<part>[a-zA-Z0-9 ]+)! Bring me (\\d+|one) more components? to fix the giant!");
+ private final Pattern notFinalPattern = Pattern.compile("\\[NPC] Professor Robot: That's not the final component! Bring me a (?<part>[a-zA-Z0-9 ]+) to gain access to Automaton Prime's storage container!");
+ private final Pattern obtainCrystalPattern = Pattern.compile(" +(?<crystal>[a-zA-Z]+) Crystal");
+ private final Pattern crystalNotPlacedPattern = Pattern.compile(".*: You haven't placed the (?<crystal>[a-zA-Z]+) Crystal yet!");
+ private final Pattern crystalPlacedPattern = Pattern.compile(".*: You have already placed the (?<crystal>[a-zA-Z]+) Crystal!");
+ private final Pattern crystalPlacePattern = Pattern.compile("✦ You placed the (?<crystal>[a-zA-Z]+) Crystal!");
+ private final Pattern crystalReclaimPattern = Pattern.compile("✦ You reclaimed the (?<crystal>[a-zA-Z]+) Crystal!");
+
+ public CrystalHollowOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> styleSupplier) {
+ super(position, dummyStrings, styleSupplier);
+ }
+
+ @Override
+ public void update() {
+ overlayStrings = null;
+ if (!NotEnoughUpdates.INSTANCE.config.mining.crystalHollowOverlay || SBInfo.getInstance().getLocation() == null ||
+ !SBInfo.getInstance().getLocation().equals("crystal_hollows"))
+ return;
+
+ NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific();
+ if (hidden == null) return;
+ overlayStrings = new ArrayList<>();
+ HashMap<String, Integer> inventoryData = new HashMap<>();
+ for (String key : hidden.automatonParts.keySet())
+ inventoryData.put(key, 0);
+ for (String key : hidden.divanMinesParts.keySet())
+ inventoryData.put(key, 0);
+ HashMap<String, Integer> storageData = new HashMap<>(inventoryData);
+ for (ItemStack item : mc.thePlayer.inventory.mainInventory)
+ if (item != null) {
+ String name = Utils.cleanColour(item.getDisplayName());
+ if (inventoryData.containsKey(name))
+ inventoryData.put(name, inventoryData.get(name) + item.stackSize);
+ }
+ for (Map.Entry<Integer, Integer> entry : storageManager.storageConfig.displayToStorageIdMap.entrySet()) {
+ int storageId = entry.getValue();
+ StorageManager.StoragePage page = storageManager.getPage(storageId, false);
+ if (page != null && page.rows > 0)
+ for (ItemStack item : page.items)
+ if (item != null) {
+ String name = Utils.cleanColour(item.getDisplayName());
+ if (storageData.containsKey(name))
+ storageData.put(name, storageData.get(name) + item.stackSize);
+ }
+ }
+
+ for (int i : NotEnoughUpdates.INSTANCE.config.mining.crystalHollowText) {
+ switch (i) {
+ case 0:
+ if (crystalCheck()) {
+ for (String part : hidden.crystals.keySet()) {
+ switch (hidden.crystals.get(part)) {
+ case 2:
+ if (!NotEnoughUpdates.INSTANCE.config.mining.crystalHollowHideDone)
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPlacedColor] + "Placed");
+ break;
+ case 1:
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowCollectedColor] + "Collected");
+ break;
+ case 0:
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowMissingColor] + "Missing");
+ break;
+ }
+ }
+ }
+ break;
+ case 1:
+ if (crystalCheck()) {
+ int count = getCountCrystal(hidden.crystals);
+ float percent = (float) count / hidden.crystals.size() * 100;
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + "Crystals: " + getColor(percent)
+ + count + "/" + hidden.crystals.size());
+ }
+ break;
+ case 2:
+ if (crystalCheck()) {
+ int count = getCountCrystal(hidden.crystals);
+ float percent = (float) count / hidden.crystals.size() * 100;
+ DecimalFormat df = new DecimalFormat("#.#");
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + "Crystals: " + getColor(percent) +
+ df.format(percent) + "%");
+ }
+ break;
+ case 3:
+ if (automatonCheck())
+ renderParts(hidden.automatonParts, inventoryData, storageData);
+ break;
+ case 4:
+ if (automatonCheck())
+ renderPartsNumbers(hidden.automatonParts, inventoryData, storageData);
+ break;
+ case 5:
+ if (automatonCheck())
+ renderCount("Automaton parts", hidden.automatonParts, inventoryData, storageData);
+ break;
+ case 6:
+ if (automatonCheck())
+ renderPercent("Automaton parts", hidden.automatonParts, inventoryData, storageData);
+ break;
+ case 7:
+ if (divanCheck())
+ renderParts(hidden.divanMinesParts, inventoryData, storageData);
+ break;
+ case 8:
+ if (divanCheck())
+ renderPartsNumbers(hidden.divanMinesParts, inventoryData, storageData);
+ break;
+ case 9:
+ if (divanCheck())
+ renderCount("Mines of Divan parts", hidden.divanMinesParts, inventoryData, storageData);
+ break;
+ case 10:
+ if (divanCheck())
+ renderPercent("Mines of Divan parts", hidden.divanMinesParts, inventoryData, storageData);
+ break;
+ }
+ }
+ }
+
+ private void renderParts(HashMap<String, Boolean> parts, HashMap<String, Integer> inventoryData, HashMap<String, Integer> storageData) {
+ for (String part : parts.keySet()) {
+ if (parts.get(part) && !NotEnoughUpdates.INSTANCE.config.mining.crystalHollowHideDone)
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDoneColor] + "Done");
+ else if (inventoryData.get(part) >= 1)
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowInventoryColor] + "In Inventory");
+ else if (storageData.get(part) >= 1)
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowStorageColor] + "In Storage");
+ else
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowMissingColor] + "Missing");
+ }
+ }
+
+ private void renderPartsNumbers(HashMap<String, Boolean> parts, HashMap<String, Integer> inventoryData, HashMap<String, Integer> storageData) {
+ for (String part : parts.keySet()) {
+ if (parts.get(part))
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDoneColor] + (inventoryData.get(part) + storageData.get(part)));
+ else if (inventoryData.get(part) >= 1)
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowInventoryColor] + (inventoryData.get(part) + storageData.get(part)));
+ else if (storageData.get(part) >= 1)
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowStorageColor] + (inventoryData.get(part) + storageData.get(part)));
+ else
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " +
+ EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowMissingColor] + (inventoryData.get(part) + storageData.get(part)));
+ }
+ }
+
+ private void renderCount(String text, HashMap<String, Boolean> parts, HashMap<String, Integer> inventoryData, HashMap<String, Integer> storageData) {
+ int count = getCount(parts, inventoryData, storageData);
+ float percent = (float) count / parts.size() * 100;
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + text + ": " + getColor(percent) + count
+ + "/" + parts.size());
+ }
+
+ private void renderPercent(String text, HashMap<String, Boolean> parts, HashMap<String, Integer> inventoryData, HashMap<String, Integer> storageData) {
+ int count = getCount(parts, inventoryData, storageData);
+ float percent = (float) count / parts.size() * 100;
+ DecimalFormat df = new DecimalFormat("#.#");
+ overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + text + ": " + getColor(percent) +
+ df.format(percent) + "%");
+ }
+
+ private EnumChatFormatting getColor(float percent) {
+ if (percent >= 66)
+ return EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowAllColor];
+ else if (percent >= 33)
+ return EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowMiddleColor];
+ else
+ return EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowNoneColor];
+ }
+
+ private int getCount(HashMap<String, Boolean> parts, HashMap<String, Integer> inventoryData, HashMap<String, Integer> storageData) {
+ int count = 0;
+ for (String part : parts.keySet())
+ if (parts.get(part) || inventoryData.get(part) > 0 || storageData.get(part) > 0)
+ count++;
+ return count;
+ }
+
+ private int getCountCrystal(HashMap<String, Integer> parts) {
+ int count = 0;
+ for (String part : parts.keySet())
+ if (parts.get(part) > 0)
+ count++;
+ return count;
+ }
+
+ private boolean automatonCheck() {
+ return NotEnoughUpdates.INSTANCE.config.mining.crystalHollowAutomatonLocation == 0 ||
+ NotEnoughUpdates.INSTANCE.config.mining.crystalHollowAutomatonLocation == 1 &&
+ SBInfo.getInstance().location.equals("Precursor Remnants") ||
+ NotEnoughUpdates.INSTANCE.config.mining.crystalHollowAutomatonLocation >= 1 &&
+ SBInfo.getInstance().location.equals("Lost Precursor City");
+ }
+
+ private boolean divanCheck() {
+ return NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDivanLocation == 0 ||
+ NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDivanLocation == 1 &&
+ SBInfo.getInstance().location.equals("Mithril Deposits") ||
+ NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDivanLocation >= 1 &&
+ SBInfo.getInstance().location.equals("Mines of Divan");
+ }
+
+ private boolean crystalCheck() {
+ return NotEnoughUpdates.INSTANCE.config.mining.crystalHollowCrystalLocation == 0 || !divanCheck() && !automatonCheck();
+ }
+
+ public void message(String message) {
+ NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific();
+ if (hidden == null) return;
+
+ Matcher crystalNotPlacedMatcher = crystalNotPlacedPattern.matcher(message);
+ Matcher crystalPlacedMatcher = crystalPlacedPattern.matcher(message);
+ Matcher crystalPlaceMatcher = crystalPlacePattern.matcher(message);
+ Matcher crystalReclaimMatcher = crystalReclaimPattern.matcher(message);
+ if (message.equals(" You've earned a Crystal Loot Bundle!"))
+ hidden.crystals.replaceAll((k, v) -> 0);
+ if (crystalNotPlacedMatcher.matches() && hidden.crystals.containsKey(crystalNotPlacedMatcher.group("crystal"))) {
+ hidden.crystals.put(crystalNotPlacedMatcher.group("crystal"), 1);
+ resetCrystal(hidden, crystalNotPlacedMatcher.group("crystal"));
+ } else if (crystalPlacedMatcher.matches() && hidden.crystals.containsKey(crystalPlacedMatcher.group("crystal"))) {
+ hidden.crystals.put(crystalPlacedMatcher.group("crystal"), 2);
+ resetCrystal(hidden, crystalPlacedMatcher.group("crystal"));
+ } else if (crystalPlaceMatcher.matches() && hidden.crystals.containsKey(crystalPlaceMatcher.group("crystal")))
+ hidden.crystals.put(crystalPlaceMatcher.group("crystal"), 2);
+ else if (crystalReclaimMatcher.matches() && hidden.crystals.containsKey(crystalReclaimMatcher.group("crystal")))
+ hidden.crystals.put(crystalReclaimMatcher.group("crystal"), 1);
+ else if (message.startsWith("[NPC] Keeper of ")) {
+ Matcher foundMatcher = foundPattern.matcher(message);
+ Matcher alreadyFoundMatcher = alreadyFoundPattern.matcher(message);
+ Matcher notFoundMatcher = notFoundPattern.matcher(message);
+ Matcher resetMatcher = resetPattern.matcher(message);
+ if (foundMatcher.matches() && hidden.divanMinesParts.containsKey(foundMatcher.group("item")))
+ hidden.divanMinesParts.put(foundMatcher.group("item"), true);
+ else if (notFoundMatcher.matches() && hidden.divanMinesParts.containsKey(notFoundMatcher.group("item")))
+ hidden.divanMinesParts.put(notFoundMatcher.group("item"), false);
+ else if (resetMatcher.matches())
+ hidden.divanMinesParts.replaceAll((k, v) -> false);
+ else if (alreadyFoundMatcher.matches() && hidden.divanMinesParts.containsKey(alreadyFoundMatcher.group("item")))
+ hidden.divanMinesParts.put(alreadyFoundMatcher.group("item"), true);
+ } else if (message.startsWith(" ")) {
+ Matcher crystalMatcher = obtainCrystalPattern.matcher(message);
+ if (crystalMatcher.matches() && hidden.crystals.containsKey(crystalMatcher.group("crystal")))
+ hidden.crystals.put(crystalMatcher.group("crystal"), 1);
+ else {
+ String item = message.replace(" ", "");
+ if (hidden.automatonParts.containsKey(item))
+ hidden.automatonParts.put(item, false);
+ }
+ } else if (message.startsWith("[NPC] Professor Robot: ")) {
+ switch (message) {
+ case "[NPC] Professor Robot: That's not one of the components I need! Bring me one of the missing components:":
+ hidden.automatonParts.replaceAll((k, v) -> true);
+ break;
+ case "[NPC] Professor Robot: You've brought me all of the components!":
+ hidden.automatonParts.replaceAll((k, v) -> false);
+ break;
+ default:
+ Matcher giveMatcher = givePattern.matcher(message);
+ Matcher notFinalMatcher = notFinalPattern.matcher(message);
+ if (giveMatcher.matches()) {
+ String item = giveMatcher.group("part");
+ if (hidden.automatonParts.containsKey(item)) {
+ hidden.automatonParts.put(item, true);
+ }
+ } else if (notFinalMatcher.matches()) {
+ String item = notFinalMatcher.group("part");
+ if (hidden.automatonParts.containsKey(item)) {
+ hidden.automatonParts.replaceAll((k, v) -> true);
+ hidden.automatonParts.put(item, false);
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ private void resetCrystal(NEUConfig.HiddenProfileSpecific hidden, String crystal) {
+ switch (crystal) {
+ case "Sapphire":
+ hidden.automatonParts.replaceAll((k, v) -> false);
+ break;
+ case "Jade":
+ hidden.divanMinesParts.replaceAll((k, v) -> false);
+ break;
+ }
+ }
+
+ @Override
+ protected void renderLine(String line, Vector2f position, boolean dummy) {
+ if (!NotEnoughUpdates.INSTANCE.config.mining.crystalHollowIcons) return;
+ GlStateManager.enableDepth();
+
+ ItemStack icon = null;
+ String cleaned = Utils.cleanColour(line);
+ String beforeColon = cleaned.split(":")[0];
+ switch (beforeColon) {
+ case "Scavenged Lapis Sword":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_LAPIS_SWORD"));
+ break;
+ case "Scavenged Golden Hammer":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_GOLD_HAMMER"));
+ break;
+ case "Scavenged Diamond Axe":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_DIAMOND_AXE"));
+ break;
+ case "Scavenged Emerald Hammer":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_EMERALD_HAMMER"));
+ break;
+ case "Electron Transmitter":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ELECTRON_TRANSMITTER"));
+ break;
+ case "FTX 3070":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("FTX_3070"));
+ break;
+ case "Robotron Reflector":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ROBOTRON_REFLECTOR"));
+ break;
+ case "Superlite Motor":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SUPERLITE_MOTOR"));
+ break;
+ case "Control Switch":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("CONTROL_SWITCH"));
+ break;
+ case "Synthetic Heart":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SYNTHETIC_HEART"));
+ break;
+ case "Amber":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_AMBER_GEM"));
+ break;
+ case "Sapphire":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_SAPPHIRE_GEM"));
+ break;
+ case "Jade":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_JADE_GEM"));
+ break;
+ case "Amethyst":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_AMETHYST_GEM"));
+ break;
+ case "Topaz":
+ icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_TOPAZ_GEM"));
+ break;
+ }
+
+ if (icon != null) {
+ GlStateManager.pushMatrix();
+ GlStateManager.translate(position.x, position.y, 0);
+ GlStateManager.scale(0.5f, 0.5f, 1f);
+ Utils.drawItemStack(icon, 0, 0);
+ GlStateManager.popMatrix();
+
+ position.x += 12;
+ }
+
+ super.renderLine(line, position, dummy);
+ }
+
+ @Override
+ protected Vector2f getSize(List<String> strings) {
+ if (NotEnoughUpdates.INSTANCE.config.mining.crystalHollowIcons)
+ return super.getSize(strings).translate(12, 0);
+ return super.getSize(strings);
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java
deleted file mode 100644
index 85ac2f82..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java
+++ /dev/null
@@ -1,142 +0,0 @@
-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.miscfeatures.StorageManager;
-import io.github.moulberry.notenoughupdates.options.NEUConfig;
-import io.github.moulberry.notenoughupdates.util.SBInfo;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import org.lwjgl.util.vector.Vector2f;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Supplier;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class DivanMinesOverlay extends TextOverlay {
- private static final Minecraft mc = Minecraft.getMinecraft();
- private final StorageManager storageManager = StorageManager.getInstance();
- private final Pattern notFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Talk to me when you have found a (?<item>[a-z-A-Z ]+)!");
- private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Excellent! You have returned the (?<item>[a-z-A-Z ]+) to its rightful place!");
- private final Pattern resetPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (You haven't placed the Jade Crystal yet!|You found all of the items! Behold\\.\\.\\. the Jade Crystal!|You have already placed the Jade Crystal!)");
- private final Pattern alreadyFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: You have already restored this Dwarf's (?<item>[a-z-A-Z ]+)!");
-
- public DivanMinesOverlay(Position position, Supplier<List<String>> dummyStrings, Supplier<TextOverlayStyle> styleSupplier) {
- super(position, dummyStrings, styleSupplier);
- }
-
- @Override
- public void update() {
- overlayStrings = null;
- if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesOverlay || SBInfo.getInstance().getLocation() == null ||
- !SBInfo.getInstance().getLocation().equals("crystal_hollows") || !SBInfo.getInstance().location.equals("Mines of Divan"))
- return;
-
- NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific();
- if (hidden == null) return;
- overlayStrings = new ArrayList<>();
- HashMap<String, String> states = new HashMap<>();
- for (String key : hidden.divanMinesParts.keySet()) {
- Boolean has = hidden.divanMinesParts.get(key);
- if (has)
- states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesDoneColor] + "Done");
- }
- for (ItemStack item : mc.thePlayer.inventory.mainInventory) {
- if (item != null) {
- String name = Utils.cleanColour(item.getDisplayName());
- if (!states.containsKey(name)) {
- states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesInventoryColor] + "In Inventory");
- }
- }
- }
- for (Map.Entry<Integer, Integer> entry : storageManager.storageConfig.displayToStorageIdMap.entrySet()) {
- int storageId = entry.getValue();
- StorageManager.StoragePage page = storageManager.getPage(storageId, false);
- if (page != null && page.rows > 0) {
- for (ItemStack item : page.items) {
- if (item != null) {
- String name = Utils.cleanColour(item.getDisplayName());
- if (!states.containsKey(name)) {
- states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesStorageColor] + "In Storage");
- }
- }
- }
- }
- }
- for (String key : hidden.divanMinesParts.keySet()) {
- if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesHideDone || !hidden.divanMinesParts.get(key)) {
- if (!states.containsKey(key))
- states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesMissingColor] + "Missing");
- overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesPartColor] + key + ": " + states.get(key));
- }
- }
- }
-
- public void message(String message) {
- NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific();
- if (hidden == null) return;
- Matcher foundMatcher = foundPattern.matcher(message);
- Matcher alreadyFoundMatcher = alreadyFoundPattern.matcher(message);
- Matcher notFoundMatcher = notFoundPattern.matcher(message);
- Matcher resetMatcher = resetPattern.matcher(message);
- System.out.println(message);
- if (foundMatcher.matches() && hidden.divanMinesParts.containsKey(foundMatcher.group("item")))
- hidden.divanMinesParts.put(foundMatcher.group("item"), true);
- else if (notFoundMatcher.matches() && hidden.divanMinesParts.containsKey(notFoundMatcher.group("item")))
- hidden.divanMinesParts.put(notFoundMatcher.group("item"), false);
- else if (resetMatcher.matches())
- hidden.divanMinesParts.replaceAll((k, v) -> false);
- else if (alreadyFoundMatcher.matches() && hidden.divanMinesParts.containsKey(alreadyFoundMatcher.group("item")))
- hidden.divanMinesParts.put(alreadyFoundMatcher.group("item"), true);
- }
-
- @Override
- protected void renderLine(String line, Vector2f position, boolean dummy) {
- if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesIcons) return;
- GlStateManager.enableDepth();
-
- ItemStack icon = null;
- String cleaned = Utils.cleanColour(line);
- String beforeColon = cleaned.split(":")[0];
- switch (beforeColon) {
- case "Scavenged Lapis Sword":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_LAPIS_SWORD"));
- break;
- case "Scavenged Golden Hammer":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_GOLD_HAMMER"));
- break;
- case "Scavenged Diamond Axe":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_DIAMOND_AXE"));
- break;
- case "Scavenged Emerald Hammer":
- icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_EMERALD_HAMMER"));
- break;
- }
-
- if (icon != null) {
- GlStateManager.pushMatrix();
- GlStateManager.translate(position.x, position.y, 0);
- GlStateManager.scale(0.5f, 0.5f, 1f);
- Utils.drawItemStack(icon, 0, 0);
- GlStateManager.popMatrix();
-
- position.x += 12;
- }
-
- super.renderLine(line, position, dummy);
- }
-
- @Override
- protected Vector2f getSize(List<String> strings) {
- if (NotEnoughUpdates.INSTANCE.config.mining.divanMinesIcons)
- return super.getSize(strings).translate(12, 0);
- return super.getSize(strings);
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java
index f82f482e..b1cf5b11 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java
@@ -16,8 +16,7 @@ public class OverlayManager {
public static PetInfoOverlay petInfoOverlay;
public static TimersOverlay timersOverlay;
public static BonemerangOverlay bonemerangOverlay;
- public static AutomatonOverlay automatonOverlay;
- public static DivanMinesOverlay divanMinesOverlay;
+ public static CrystalHollowOverlay crystalHollowOverlay;
public static final List<TextOverlay> textOverlays = new ArrayList<>();
static {
@@ -122,29 +121,48 @@ public class OverlayManager {
}
return TextOverlayStyle.BACKGROUND;
});
- List<String> automatonOverlayDummy = Lists.newArrayList(
- "\u00a73Electron Transmitter: \u00a7aDone",
- "\u00a73Robotron Reflector: \u00a7eIn Storage",
- "\u00a73Superlite Motor: \u00a7eIn Inventory",
- "\u00a73Synthetic Hearth: \u00a7cMissing",
- "\u00a73Control Switch: \u00a7cMissing",
- "\u00a73FTX 3070: \u00a7cMissing");
- automatonOverlay = new AutomatonOverlay(NotEnoughUpdates.INSTANCE.config.mining.automatonOverlayPosition, () -> automatonOverlayDummy, () -> {
- int style = NotEnoughUpdates.INSTANCE.config.mining.automatonOverlayStyle;
- if(style >= 0 && style < TextOverlayStyle.values().length) {
- return TextOverlayStyle.values()[style];
- }
- return TextOverlayStyle.BACKGROUND;
- });
- List<String> divanMinesOverlayDummy = Lists.newArrayList(
- "\u00a73Scavenged Lapis Sword: \u00a7aDone",
- "\u00a73Scavenged Golden Hammer: \u00a7eIn Storage",
- "\u00a73Scavenged Diamond Axe: \u00a7eIn Inventory",
- "\u00a73Scavenged Emerald Hammer: \u00a7cMissing"
+ List<String> crystalHollowOverlayDummy = Lists.newArrayList(
+ "\u00a73Amber Crystal: \u00a7aPlaced\n" +
+ "\u00a73Sapphire Crystal: \u00a7eCollected\n" +
+ "\u00a73Jade Crystal: \u00a7eMissing\n" +
+ "\u00a73Amethyst Crystal: \u00a7cMissing\n" +
+ "\u00a73Topaz Crystal: \u00a7cMissing\n",
+ "\u00a73Crystals: \u00a7a4/5",
+ "\u00a73Crystals: \u00a7a80%",
+ "\u00a73Electron Transmitter: \u00a7aDone\n" +
+ "\u00a73Robotron Reflector: \u00a7eIn Storage\n" +
+ "\u00a73Superlite Motor: \u00a7eIn Inventory\n" +
+ "\u00a73Synthetic Hearth: \u00a7cMissing\n" +
+ "\u00a73Control Switch: \u00a7cMissing\n" +
+ "\u00a73FTX 3070: \u00a7cMissing",
+ "\u00a73Electron Transmitter: \u00a7a3\n" +
+ "\u00a73Robotron Reflector: \u00a7e2\n" +
+ "\u00a73Superlite Motor: \u00a7e1\n" +
+ "\u00a73Synthetic Hearth: \u00a7c0\n" +
+ "\u00a73Control Switch: \u00a7c0\n" +
+ "\u00a73FTX 3070: \u00a7c0",
+ "\u00a73Automaton parts: \u00a7a5/6",
+ "\u00a73Automaton parts: \u00a7a83%",
+ "\u00a73Scavenged Lapis Sword: \u00a7aDone\n" +
+ "\u00a73Scavenged Golden Hammer: \u00a7eIn Storage\n" +
+ "\u00a73Scavenged Diamond Axe: \u00a7eIn Inventory\n" +
+ "\u00a73Scavenged Emerald Hammer: \u00a7cMissing\n",
+ "\u00a73Scavenged Lapis Sword: \u00a7a3\n" +
+ "\u00a73Scavenged Golden Hammer: \u00a7e2\n" +
+ "\u00a73Scavenged Diamond Axe: \u00a7e1\n" +
+ "\u00a73Scavenged Emerald Hammer: \u00a7c0\n",
+ "\u00a73Mines of Divan parts: \u00a7a3/4",
+ "\u00a73Mines of Divan parts: \u00a7a75%"
);
- divanMinesOverlay = new DivanMinesOverlay(NotEnoughUpdates.INSTANCE.config.mining.divanMinesOverlayPosition, () -> divanMinesOverlayDummy, () -> {
- int style = NotEnoughUpdates.INSTANCE.config.mining.divanMinesOverlayStyle;
- if(style >= 0 && style < TextOverlayStyle.values().length) {
+ crystalHollowOverlay = new CrystalHollowOverlay(NotEnoughUpdates.INSTANCE.config.mining.crystalHollowOverlayPosition, () -> {
+ List<String> strings = new ArrayList<>();
+ for (int i : NotEnoughUpdates.INSTANCE.config.mining.crystalHollowText) {
+ if (i >= 0 && i < crystalHollowOverlayDummy.size()) strings.add(crystalHollowOverlayDummy.get(i));
+ }
+ return strings;
+ }, () -> {
+ int style = NotEnoughUpdates.INSTANCE.config.mining.crystalHollowOverlayStyle;
+ if (style >= 0 && style < TextOverlayStyle.values().length) {
return TextOverlayStyle.values()[style];
}
return TextOverlayStyle.BACKGROUND;
@@ -154,8 +172,7 @@ public class OverlayManager {
textOverlays.add(farmingOverlay);
textOverlays.add(petInfoOverlay);
textOverlays.add(bonemerangOverlay);
- textOverlays.add(automatonOverlay);
- textOverlays.add(divanMinesOverlay);
+ textOverlays.add(crystalHollowOverlay);
}
}