Added config for extra debugging.

This commit is contained in:
2025-05-24 22:47:44 +01:00
parent 042ebf10dc
commit b287f43e74
2 changed files with 14 additions and 4 deletions

View File

@ -63,6 +63,8 @@ public final class Config {
}
public static class Server {
public static ForgeConfigSpec.BooleanValue debugExtra;
public static ForgeConfigSpec.BooleanValue optimizationUseCache;
private static ForgeConfigSpec.ConfigValue<List<? extends String>> blockBreakGlobalOperationsRaw;
@ -71,6 +73,12 @@ public final class Config {
public static List<OperationItem> blockBreakOperationItems;
Server(ForgeConfigSpec.Builder builder) {
builder.comment("Settings for debugging").push("debug");
debugExtra = builder
.comment("Whether to log more extensive debug information.")
.define("debugExtra", false);
builder.pop();
builder.comment("Settings for optimizations").push("optimization");
optimizationUseCache = builder
.comment("When enabled, the list of operations to perform per unique_id will be cached after the first calculation.")

View File

@ -110,10 +110,12 @@ public class OnBlockBreakEventHandler {
}
// Debug logging
XpTools.LOGGER.debug("Completed block break event:");
XpTools.LOGGER.debug("\tOperations: {}", operations);
XpTools.LOGGER.debug("\tTime taken (nano seconds): {}", Duration.between(start, Instant.now()).toNanos());
XpTools.LOGGER.debug("\tXP: {} -> {}", event.getExpToDrop(), xpToDrop);
if (Config.Server.debugExtra.get()) {
XpTools.LOGGER.debug("Completed block break event:");
XpTools.LOGGER.debug("\tOperations: {}", operations);
XpTools.LOGGER.debug("\tTime taken (nano seconds): {}", Duration.between(start, Instant.now()).toNanos());
XpTools.LOGGER.debug("\tXP: {} -> {}", event.getExpToDrop(), xpToDrop);
}
// Apply xp drop
event.setExpToDrop((int)xpToDrop);