Skip to content

Macro examples

Choose Examples in the JavaScript editor or Node builder. Applying an example replaces the current editor contents; save afterward if you want it stored.

JavaScript examples

The bundled set covers chat commands, auto tool/eat, packet watching, following/pathfinding, inventory tidy, mining input, replay HUD, replay playlists and queueing, safety/AFK input, file session logs, HTTP lookup, sound/scoreboard, fluent wrappers, HUD/tab/title data, equipment checks, surroundings/entities, travel, and the diagnostic suite. Each example imports only mint:api names that exist in all five declarations, while runtime packet/sound identifiers remain version-specific.

The Diagnostic suite is the broad compatibility test. Type !jstest help; its subcommands test snapshots, events, packets, effects, render, target marking, input, async/worker work, HTTP, path/follow/stop, and help text. Read both local chat and the macro runtime log. Packet tests intentionally capture only the armed next packet so a high-frequency listener does not flood logs.

Walking and flying somewhere

!go 120 70 -32 sends the player there. goTo returns whether it could start, not whether it arrived, so watch isActive():

on(EventType.Chat, (event) => {
const parts = event.message.split(" ");
if (parts[0] !== "!go") return;
event.cancel();
const [x, y, z] = parts.slice(1).map(Number);
Pathfinder.goTo(x, y, z); // flies in creative, walks otherwise
const watch = Timers.every(500, () => {
if (Pathfinder.isActive()) return;
Timers.clear(watch);
Chat.print("done");
});
});

See the JavaScript API reference for the options.

Running a list of replays

Replay playlist turns Mint’s loop into a rotation. Nothing is ever stopped: while a clip is playing the macro queues the one that should follow it, and the loop plays that instead of repeating. Turn Loop replay on with a Loop amount of 0, or the rotation stops once the loop’s shared count runs out — and load each clip in the Replays tab, since queueing an unloaded one is refused:

const playlist = ["first-replay-id", "second-replay-id"];
const nextAfter = (id) => playlist[(playlist.indexOf(id) + 1) % playlist.length];
// Queue as soon as a run starts, so the next clip is settled before the loop needs it.
Events.on(EventType.REPLAY_START_POST, (event) => {
const next = nextAfter(event.replayId);
if (next !== event.replayId) Replay.queue(next);
});

Queue the next replay does the same by hand — !next <id>, !next, !next off — and shows the other reason to queue rather than stop: swapping clip on a condition keeps every position and camera check armed across the switch, which a stop-and-start would drop. See Replay queue for what the switch does and does not skip.

Node examples

Smaller graphs demonstrate dropping matching items, following, a cancelled coordinates command, mining the crosshair target, greeting after a delay, a one-shot low-health warning, held-key mining, automatic tools, a follow command, inventory tidy, looking at the nearest player, marking a position, a cooldown mob alarm, packet inspection, and a randomized jump.

The Diagnostic suite uses !ntest for values/strings/lists/variables/delay and exposes focused commands such as !nitems, !nmove, !nlook, !nmark, !npath, !nstop, !npacket, and !ntick. It also listens for G and replay transitions. The normal player inventory must report no container open; !nlook turns east rather than aiming at the block used to type the command.

Compatibility checks used by the project

Before release, node MintClient/MacroRuntime/tools/validate-bootstrap.mjs executes the runtime bootstrap wrappers, and node MintClient/MacroRuntime/tools/validate-examples.mjs type-checks every JavaScript example against 1.8.9, 1.18.2, 1.20.4, 1.21 and 26.2, checks Studio/site copies, validates every Node block/option/connection, and checks the 64 KiB limit.