From 73fad7064fb47d9d79ccdb3bab5988df1b9eea6f Mon Sep 17 00:00:00 2001 From: CraftyOldMiner <85420839+CraftyOldMiner@users.noreply.github.com> Date: Mon, 7 Mar 2022 21:44:17 -0600 Subject: Wishing Compass Solver, Metal Detector Solver improvements, add /neudiag, other misc changes (#90) --- .../notenoughupdates/util/NEUDebugLogger.java | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/util/NEUDebugLogger.java (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/NEUDebugLogger.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/NEUDebugLogger.java b/src/main/java/io/github/moulberry/notenoughupdates/util/NEUDebugLogger.java new file mode 100644 index 00000000..d662a872 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/NEUDebugLogger.java @@ -0,0 +1,30 @@ +package io.github.moulberry.notenoughupdates.util; + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.options.customtypes.NEUDebugFlag; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +import java.util.Collections; +import java.util.EnumSet; +import java.util.function.Consumer; + +public class NEUDebugLogger { + private static final Minecraft mc = Minecraft.getMinecraft(); + public static Consumer logMethod = NEUDebugLogger::chatLogger; + + private static void chatLogger(String message) { + mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU DEBUG] " + message)); + } + + public static boolean isFlagEnabled(NEUDebugFlag flag) { + return NotEnoughUpdates.INSTANCE.config.hidden.debugFlags.contains(flag); + } + + public static void log(NEUDebugFlag flag, String message) { + if (logMethod != null && isFlagEnabled(flag)) { + logMethod.accept(message); + } + } +} -- cgit