From e3434115acfa2bd17538dd38856957251cb07519 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 20 Sep 2018 13:29:26 -0700 Subject: [PATCH] logger --- src/main/java/baritone/Settings.java | 8 ++++++++ src/main/java/baritone/utils/Helper.java | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/Settings.java b/src/main/java/baritone/Settings.java index 286c06e7..4545faa8 100644 --- a/src/main/java/baritone/Settings.java +++ b/src/main/java/baritone/Settings.java @@ -17,11 +17,14 @@ package baritone; +import baritone.utils.Helper; import net.minecraft.init.Blocks; import net.minecraft.item.Item; +import net.minecraft.util.text.ITextComponent; import java.lang.reflect.Field; import java.util.*; +import java.util.function.Consumer; /** * Baritone's settings @@ -375,6 +378,11 @@ public class Settings { */ public Setting followRadius = new Setting<>(3); + /** + * Instead of Baritone logging to chat, set a custom consumer. + */ + public Setting> logger = new Setting<>(new Helper() {}::addToChat); + public final Map> byLowerName; public final List> allSettings; diff --git a/src/main/java/baritone/utils/Helper.java b/src/main/java/baritone/utils/Helper.java index d808e632..9924d0bf 100755 --- a/src/main/java/baritone/utils/Helper.java +++ b/src/main/java/baritone/utils/Helper.java @@ -96,6 +96,11 @@ public interface Helper { ITextComponent component = MESSAGE_PREFIX.createCopy(); component.getStyle().setColor(TextFormatting.GRAY); component.appendSibling(new TextComponentString(" " + message)); - mc.ingameGUI.getChatGUI().printChatMessage(component); + Baritone.settings().logger.get().accept(component); } + + default void addToChat(ITextComponent msg) { + mc.ingameGUI.getChatGUI().printChatMessage(msg); + } + }