From 7e5bcda8fde6719562247c1f233985ac07d9f560 Mon Sep 17 00:00:00 2001 From: jani270 <69345714+jani270@users.noreply.github.com> Date: Tue, 30 Apr 2024 06:37:59 +0200 Subject: Add Titles to the Metal Detector Solver (#1136) --- .../miscfeatures/CrystalMetalDetectorSolver.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java') 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 && -- cgit