logger
This commit is contained in:
parent
ddf7b3739a
commit
e3434115ac
@ -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;
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user