MCPcopy Index your code
hub / github.com/cabaletta/baritone / Helper

Interface Helper

src/api/java/baritone/api/utils/Helper.java:39–245  ·  view source on GitHub ↗

An ease-of-access interface to provide the Minecraft game instance, chat and console logging mechanisms, and the Baritone chat prefix. @author Brady @since 8/1/2018

Source from the content-addressed store, hash-verified

37 * @since 8/1/2018
38 */
39public interface Helper {
40
41 /**
42 * Instance of {@link Helper}. Used for static-context reference.
43 */
44 Helper HELPER = new Helper() {};
45
46 /**
47 * The main game instance returned by {@link Minecraft#getInstance()}.
48 * Deprecated since {@link IPlayerContext#minecraft()} should be used instead (In the majority of cases).
49 */
50 @Deprecated
51 Minecraft mc = Minecraft.getInstance();
52
53 /**
54 * The tag to assign to chat messages when {@link Settings#useMessageTag} is {@code true}.
55 */
56 GuiMessageTag MESSAGE_TAG = new GuiMessageTag(0xFF55FF, null, Component.literal("Baritone message."), "Baritone");
57
58 static Component getPrefix() {
59 // Inner text component
60 final Calendar now = Calendar.getInstance();
61 final boolean xd = now.get(Calendar.MONTH) == Calendar.APRIL && now.get(Calendar.DAY_OF_MONTH) <= 3;
62 MutableComponent baritone = Component.literal(xd ? "Baritoe" : BaritoneAPI.getSettings().shortBaritonePrefix.value ? "B" : "Baritone");
63 baritone.setStyle(baritone.getStyle().withColor(ChatFormatting.LIGHT_PURPLE));
64
65 // Outer brackets
66 MutableComponent prefix = Component.literal("");
67 prefix.setStyle(baritone.getStyle().withColor(ChatFormatting.DARK_PURPLE));
68 prefix.append("[");
69 prefix.append(baritone);
70 prefix.append("]");
71
72 return prefix;
73 }
74
75 /**
76 * Send a message to display as a toast popup
77 *
78 * @param title The title to display in the popup
79 * @param message The message to display in the popup
80 */
81 default void logToast(Component title, Component message) {
82 Minecraft.getInstance().execute(() -> BaritoneAPI.getSettings().toaster.value.accept(title, message));
83 }
84
85 /**
86 * Send a message to display as a toast popup
87 *
88 * @param title The title to display in the popup
89 * @param message The message to display in the popup
90 */
91 default void logToast(String title, String message) {
92 logToast(Component.literal(title), Component.literal(message));
93 }
94
95 /**
96 * Send a message to display as a toast popup

Callers 28

bestSoFarMethod · 0.80
onTickMethod · 0.80
onTickMethod · 0.80
onTickMethod · 0.80
onTickMethod · 0.80
onTickMethod · 0.80
onTickMethod · 0.80
rescanMethod · 0.80
pruneMethod · 0.80
FavoringMethod · 0.80
onTickMethod · 0.80
requestSwapWithHotBarMethod · 0.80

Implementers 11

CachedWorldsrc/main/java/baritone/cache/CachedWor
GuiClicksrc/main/java/baritone/utils/GuiClick.
BaritoneProcessHelpersrc/main/java/baritone/utils/BaritoneP
InventoryBehaviorsrc/main/java/baritone/behavior/Invent
PathingBehaviorsrc/main/java/baritone/behavior/Pathin
ExampleBaritoneControlsrc/main/java/baritone/command/Example
PathExecutorsrc/main/java/baritone/pathing/path/Pa
AbstractNodeCostSearchsrc/main/java/baritone/pathing/calc/Ab
ElytraBehaviorsrc/main/java/baritone/process/elytra/
GameEventHandlersrc/main/java/baritone/event/GameEvent
Paginatorsrc/api/java/baritone/api/command/help

Calls

no outgoing calls

Tested by

no test coverage detected