This commit is contained in:
Leijurv 2018-09-20 13:29:26 -07:00
parent ddf7b3739a
commit e3434115ac
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 14 additions and 1 deletions

View File

@ -17,11 +17,14 @@
package baritone; package baritone;
import baritone.utils.Helper;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.text.ITextComponent;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.*; import java.util.*;
import java.util.function.Consumer;
/** /**
* Baritone's settings * Baritone's settings
@ -375,6 +378,11 @@ public class Settings {
*/ */
public Setting<Integer> followRadius = new Setting<>(3); public Setting<Integer> followRadius = new Setting<>(3);
/**
* Instead of Baritone logging to chat, set a custom consumer.
*/
public Setting<Consumer<ITextComponent>> logger = new Setting<>(new Helper() {}::addToChat);
public final Map<String, Setting<?>> byLowerName; public final Map<String, Setting<?>> byLowerName;
public final List<Setting<?>> allSettings; public final List<Setting<?>> allSettings;

View File

@ -96,6 +96,11 @@ public interface Helper {
ITextComponent component = MESSAGE_PREFIX.createCopy(); ITextComponent component = MESSAGE_PREFIX.createCopy();
component.getStyle().setColor(TextFormatting.GRAY); component.getStyle().setColor(TextFormatting.GRAY);
component.appendSibling(new TextComponentString(" " + message)); 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);
}
} }