From 0401cb030a57765eb5d0eff36453add731b69e03 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sat, 21 Aug 2021 14:11:39 +0200 Subject: only show waypoints when in mines of divan --- .../notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java | 3 ++- .../java/io/github/moulberry/notenoughupdates/util/SBInfo.java | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index 357d8326..73e2b412 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -81,7 +81,8 @@ public class CrystalMetalDetectorSolver { } public static void render(float partialTicks) { - if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows")) { + if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && + SBInfo.getInstance().location.equals("Mines of Divan")) { if (possibleBlocks.size() == 1) { RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0).add(0, 2.5, 0), partialTicks); } else if (possibleBlocks.size() > 1 && NotEnoughUpdates.INSTANCE.config.mining.metalDetectorShowPossible) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java index 243ee151..c837fc5f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java @@ -194,7 +194,12 @@ public class SBInfo { currentTimeDate = parseFormat.parse(timeSpace); } catch (ParseException e) {} } - location = Utils.cleanColour(lines.get(3)).replaceAll("[^A-Za-z0-9() ]", "").trim(); + //Replaced with for loop because in crystal hollows with events the line it's on can shift. + for (String line : lines){ + if (line.contains("⏣")) { + location = Utils.cleanColour(line).replaceAll("[^A-Za-z0-9() ]", "").trim(); + } + } } objective = null; -- cgit From 3b88fe9207828d4292b3d666d966c58c139c7aeb Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sat, 21 Aug 2021 20:19:12 +0200 Subject: done --- .../notenoughupdates/NEUEventListener.java | 2 + .../notenoughupdates/options/NEUConfig.java | 3 +- .../options/seperateSections/Mining.java | 126 +++++++++++++++ .../overlays/AutomatonOverlay.java | 169 +++++++++++++++++++++ .../notenoughupdates/overlays/OverlayManager.java | 17 ++- .../notenoughupdates/overlays/TimersOverlay.java | 4 +- 6 files changed, 318 insertions(+), 3 deletions(-) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 0f45eb1a..8c668da0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -836,6 +836,8 @@ 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); } 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 a839b3a2..3aca1041 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -85,7 +85,8 @@ public class NEUConfig extends Config { case 9: editOverlay(activeConfigCategory, OverlayManager.bonemerangOverlay, itemOverlays.bonemerangPosition); return; - + case 10: + editOverlay(activeConfigCategory, OverlayManager.automatonOverlay, mining.automatonOverlayPosition); } } 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 2c05b462..3d5c0b09 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 @@ -165,6 +165,132 @@ public class Mining { @ConfigAccordionId(id = 3) public boolean metalDetectorShowPossible = false; + @ConfigOption( + name = "Automaton Parts Overlay", + desc = "" + ) + @ConfigEditorAccordion(id = 4) + public boolean automatonOverlayAccordion = false; + + @Expose + @ConfigOption( + name = "Enabled", + desc = "Enables the Automaton parts overlay." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 4) + public boolean automatonOverlay = true; + + @Expose + @ConfigOption( + name = "Position", + desc = "Change the position of the Automaton parts overlay." + ) + @ConfigEditorButton( + runnableId = 10, + buttonText = "Edit" + ) + @ConfigAccordionId(id = 4) + public Position automatonOverlayPosition = new Position(200, 0); + + @Expose + @ConfigOption( + name = "Style", + desc = "Change the style of the Automaton parts overlay." + ) + @ConfigEditorDropdown( + values = {"Background", "No Shadow", "Shadow", "Full Shadow"} + ) + @ConfigAccordionId(id = 4) + public int automatonOverlayStyle = 0; + + @Expose + @ConfigOption( + name = "Show Icons", + desc = "Show icons in the overlay that represent the part." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 4) + public boolean automatonIcons = true; + + + @Expose + @ConfigOption( + name = "Hide Done", + desc = "Don't show parts you've given to Professor Robot." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 4) + public boolean automatonHideDone = false; + + @ConfigOption( + name = "Colours", + desc = "" + ) + @ConfigEditorAccordion(id = 5) + @ConfigAccordionId(id = 4) + public boolean AutomatonColourAccordion = false; + + @Expose + @ConfigOption( + name = "Part colour", + desc = "Change the colour of the part text." + + ) + @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 automatonPartColor = 3; + + @Expose + @ConfigOption( + name = "Ready colour", + desc = "Change the colour when the part is given to Professor Robot." + + ) + @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 automatonDoneColor = 10; + + @Expose + @ConfigOption( + name = "In Inventory Color", + desc = "Change the colour when the part is in the inventory." + + ) + @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 automatonInventoryColor = 14; + + @Expose + @ConfigOption( + name = "In Storage Color", + desc = "Change the colour when the part is in the storage." + + ) + @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; + + @Expose + @ConfigOption( + name = "Missing Color", + desc = "Change the colour when the part is missing." + + ) + @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; + @Expose @ConfigOption( name = "Puzzler Solver", diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java new file mode 100644 index 00000000..981f269e --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java @@ -0,0 +1,169 @@ +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.util.SBInfo; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.item.Item; +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 HashMap items; + 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 (?[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 (?[a-zA-Z0-9 ]+) to gain access to Automaton Prime's storage container!"); + + static { + items = new HashMap<>(); + items.put("Electron Transmitter", false); + items.put("FTX 3070", false); + items.put("Robotron Reflector", false); + items.put("Superlite Motor", false); + items.put("Control Switch", false); + items.put("Synthetic Heart", false); + } + + public AutomatonOverlay(Position position, Supplier> dummyStrings, Supplier 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; + + overlayStrings = new ArrayList<>(); + HashMap states = new HashMap<>(); + for (String key : items.keySet()) { + Boolean has = items.get(key); + if (has) + states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonDoneColor] + "Done"); + /*else + states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonMissingColor] + "Missing");*/ + } + 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 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 : items.keySet()) { + if (!NotEnoughUpdates.INSTANCE.config.mining.automatonHideDone || !items.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) { + if (message.startsWith(" ")) { + String item = message.replace(" ", ""); + if (items.containsKey(item)) { + items.put(item, false); + } + } else if (message.startsWith("[NPC] Professor Robot: ")) { + if (message.equals("[NPC] Professor Robot: That's not one of the components I need! Bring me one of the missing components:")) { + items.replaceAll((k, v) -> true); + } else if (message.equals("[NPC] Professor Robot: You've brought me all of the components!")) { + items.replaceAll((k, v) -> false); + } else { + Matcher giveMatcher = givePattern.matcher(message); + Matcher notFinalMatcher = notFinalPattern.matcher(message); + if (giveMatcher.matches()) { + String item = giveMatcher.group("part"); + if (items.containsKey(item)) { + items.put(item, true); + } + } else if (notFinalMatcher.matches()) { + String item = notFinalMatcher.group("part"); + if (items.containsKey(item)) { + items.replaceAll((k, v) -> true); + items.put(item, false); + } + } + } + } + } + + @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 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/OverlayManager.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java index 3c1f2e3a..a08eef1e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java @@ -16,6 +16,7 @@ public class OverlayManager { public static PetInfoOverlay petInfoOverlay; public static TimersOverlay timersOverlay; public static BonemerangOverlay bonemerangOverlay; + public static AutomatonOverlay automatonOverlay; public static final List textOverlays = new ArrayList<>(); static { @@ -120,13 +121,27 @@ public class OverlayManager { } return TextOverlayStyle.BACKGROUND; }); + List 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; + }); textOverlays.add(miningOverlay); textOverlays.add(farmingOverlay); textOverlays.add(petInfoOverlay); textOverlays.add(bonemerangOverlay); - + textOverlays.add(automatonOverlay); } } 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 39bc0b60..0d111762 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -82,7 +82,9 @@ public class TimersOverlay extends TextOverlay { @Override protected Vector2f getSize(List strings) { - return super.getSize(strings).translate(12, 0); + if(NotEnoughUpdates.INSTANCE.config.miscOverlays.todoIcons) + return super.getSize(strings).translate(12, 0); + return super.getSize(strings); } private static final ItemStack CAKES_ICON = new ItemStack(Items.cake); -- cgit From 4572fcceafb87b1c24563f6fd161662899c455db Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sat, 21 Aug 2021 20:24:05 +0200 Subject: Update SBInfo.java --- src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java index c837fc5f..e41ef78d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java @@ -198,6 +198,7 @@ public class SBInfo { for (String line : lines){ if (line.contains("⏣")) { location = Utils.cleanColour(line).replaceAll("[^A-Za-z0-9() ]", "").trim(); + break; } } } -- cgit From 2ee79cb1767dab9550a87ca5208452758a100932 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sat, 21 Aug 2021 20:29:23 +0200 Subject: remove comment oops --- .../io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java index 981f269e..bbdb4786 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java @@ -54,8 +54,6 @@ public class AutomatonOverlay extends TextOverlay { Boolean has = items.get(key); if (has) states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonDoneColor] + "Done"); - /*else - states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonMissingColor] + "Missing");*/ } for (ItemStack item : mc.thePlayer.inventory.mainInventory) { if (item != null) { -- cgit