diff options
author | jani270 <69345714+jani270@users.noreply.github.com> | 2024-04-30 06:37:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-30 14:37:59 +1000 |
commit | 7e5bcda8fde6719562247c1f233985ac07d9f560 (patch) | |
tree | 8c146cbbb4bc8282411b25a3b4d876dc7a01e50b | |
parent | cc454c394f44f3dd1029ed7943e043cbe569ae0f (diff) | |
download | NotEnoughUpdates-7e5bcda8fde6719562247c1f233985ac07d9f560.tar.gz NotEnoughUpdates-7e5bcda8fde6719562247c1f233985ac07d9f560.tar.bz2 NotEnoughUpdates-7e5bcda8fde6719562247c1f233985ac07d9f560.zip |
Add Titles to the Metal Detector Solver (#1136)
2 files changed, 73 insertions, 0 deletions
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 e355c437..a78a28f4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -25,6 +25,8 @@ import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.options.customtypes.NEUDebugFlag; import io.github.moulberry.notenoughupdates.util.NEUDebugLogger; import io.github.moulberry.notenoughupdates.util.SBInfo; +import io.github.moulberry.notenoughupdates.util.SpecialColour; +import io.github.moulberry.notenoughupdates.util.TitleUtil; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.entity.item.EntityArmorStand; @@ -165,6 +167,11 @@ public class CrystalMetalDetectorSolver { // falls through case FOUND: Utils.addChatMessage(EnumChatFormatting.YELLOW + "[NEU] Found solution."); + metalDetectorTitle( + "Found Solution", + NotEnoughUpdates.INSTANCE.config.mining.metalDetectorTicks, + NotEnoughUpdates.INSTANCE.config.mining.metalDetectorFoundColor + ); if (NEUDebugFlag.METAL.isSet() && (previousState == SolutionState.INVALID || previousState == SolutionState.FAILED)) { NEUDebugLogger.log( @@ -181,6 +188,11 @@ public class CrystalMetalDetectorSolver { break; case FAILED: Utils.addChatMessage(EnumChatFormatting.RED + "[NEU] Failed to find a solution."); + metalDetectorTitle( + "Failed to find a solution!", + NotEnoughUpdates.INSTANCE.config.mining.metalDetectorTicks, + NotEnoughUpdates.INSTANCE.config.mining.metalDetectorFailedColor + ); logDiagnosticData(false); resetSolution(false); break; @@ -191,6 +203,11 @@ public class CrystalMetalDetectorSolver { Utils.addChatMessage( EnumChatFormatting.YELLOW + "[NEU] Need another position to find solution. Possible blocks: " + possibleBlocks.size()); + metalDetectorTitle( + "Need another position!", + NotEnoughUpdates.INSTANCE.config.mining.metalDetectorTicks, + NotEnoughUpdates.INSTANCE.config.mining.metalDetectorMoveColor + ); break; default: throw new IllegalStateException("Metal detector is in invalid state"); @@ -198,6 +215,12 @@ public class CrystalMetalDetectorSolver { } } + private static void metalDetectorTitle(String title, int ticks, String color) { + if (NotEnoughUpdates.INSTANCE.config.mining.metalDetectorTitle) { + TitleUtil.getInstance().createTitle(title, ticks, SpecialColour.specialToChromaRGB(color)); + } + } + static void findPossibleSolutions(double distToTreasure, Vec3Comparable playerPos, boolean centerNewlyDiscovered) { if (Math.abs(prevDistToTreasure - distToTreasure) < 0.2 && prevPlayerPos.distanceTo(playerPos) <= 0.1 && diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Mining.java index ad3c1b10..e065bf3a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Mining.java @@ -24,6 +24,7 @@ import io.github.moulberry.moulconfig.annotations.ConfigAccordionId; import io.github.moulberry.moulconfig.annotations.ConfigEditorAccordion; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorButton; +import io.github.moulberry.moulconfig.annotations.ConfigEditorColour; import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; @@ -342,6 +343,55 @@ public class Mining { @ConfigAccordionId(id = 3) public boolean metalDetectorShowPossible = false; + @Expose + @ConfigOption( + name = "Send Title", + desc = "Sends a title for solution found, failed, or additional position needed." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 3) + public boolean metalDetectorTitle = false; + + @Expose + @ConfigOption( + name = "Found Solution Title Color", + desc = "The color the alert will be shown" + ) + @ConfigEditorColour + @ConfigAccordionId(id = 3) + public String metalDetectorFoundColor = "0:255:255:255:85"; + + @Expose + @ConfigOption( + name = "Failed Solution Color", + desc = "The color the alert will be shown" + ) + @ConfigEditorColour + @ConfigAccordionId(id = 3) + public String metalDetectorFailedColor = "0:255:255:85:85"; + + @Expose + @ConfigOption( + name = "Need another Position Color", + desc = "The color the alert will be shown" + ) + @ConfigEditorColour + @ConfigAccordionId(id = 3) + public String metalDetectorMoveColor = "0:255:255:255:85"; + + @Expose + @ConfigOption( + name = "Title Display Time", + desc = "How long the display would stay for in ticks" + ) + @ConfigEditorSlider( + minValue = 1, + maxValue = 200, + minStep = 20 + ) + @ConfigAccordionId(id = 3) + public int metalDetectorTicks = 20; + @ConfigOption( name = "Crystal Hollows Overlay", desc = "" |