mc-blockpilot

sparten11740/mc-blockpilot Checked 2 days ago

Minecraft mod that lets AI agents and scripts see and play the game through a fast, token-efficient local interface.

A client-side Minecraft mod that lets AI agents and scripts see and play the game through a fast, token-efficient local interface: to play, or to play-test a mod while you develop it. For Fabric and Forge on Minecraft 1.20.1, NeoForge and Fabric on 1.21.1, 1.21.11, 26.1.2, 26.2 and 26.3, and for plain Minecraft 26.1.2, 26.2 and 26.3 without a mod loader. Put the jar for your loader and Minecraft version from the releases into the game's mods folder (Fabric also needs Fabric API) and start the game. The 1.20.1 Forge jar also runs on NeoForge 47.1.

Summary extracted from the README.

Blockpilot

release game tests

A client-side Minecraft mod that lets AI agents and scripts see and play the game through a fast, token-efficient local interface: to play, or to play-test a mod while you develop it. For Fabric and Forge on Minecraft 1.20.1, NeoForge and Fabric on 1.21.1, 1.21.11, 26.1.2, 26.2 and 26.3, and for plain Minecraft 26.1.2, 26.2 and 26.3 without a mod loader.

A script chops a tree, crafts a crafting table and places it, with the replies below the game

Install

Put the jar for your loader and Minecraft version from the releases into the game's mods folder (Fabric also needs Fabric API) and start the game. The 1.20.1 Forge jar also runs on NeoForge 47.1. Blockpilot runs beside Sodium, and beside Embeddium on 1.20.1 Forge. It listens on 127.0.0.1 only, behind a token it creates. For a mod's dev environment, see docs/dev-environment.md.

Without a mod loader, on Minecraft 26.1.2, 26.2 or 26.3: keep that version's vanilla jar in a folder whose path has no spaces, add an installation of that version in the Minecraft Launcher (or, where it offers that version, a vanilla instance in the CurseForge app) and append -javaagent:<full path to the jar> to its JVM arguments; see docs/connecting.md.

Two ways to drive it

At every start the game writes a launcher, <game dir>/blockpilot/blockpilot (blockpilot.cmd on Windows), that needs nothing else installed. The game dir is ~/Library/Application Support/minecraft on macOS, %APPDATA%\.minecraft on Windows and ~/.minecraft on Linux, or the instance's folder in a launcher such as Prism or CurseForge.

MCP, for AI agents. The launcher serves MCP over stdio. Add it to your agent once; it keeps working through restarts of the game. The agent gets three tools: run (a script of commands), screenshot and help.

claude mcp add --transport stdio blockpilot -- "<game dir>/blockpilot/blockpilot" --mcp

Commands, from a shell or a script. The launcher runs a script of commands, separated by ;, and prints one reply per command. The first err stops the script, and the exit code is 0 when every command answered ok.

"<game dir>/blockpilot/blockpilot" --wait-world "select iron_pickaxe; mine #logs x3; inv"
ok hand:iron_pickaxe
ok mine 3/3 oak_log
ok
  ~ 1:iron_pickaxe dur247/250
  + 5:oak_log x3
! got oak_log x3

Agents see what happens through replies, logs and screenshots, like this screenshot burst=8 every=7t sheet of TNT going off:

Eight frames of a TNT blast in a grid, each labelled with its frame number and game tick

The window can stay in the background. Real keyboard or mouse input stops what the agent is doing, and F8 turns agent control off. MCP over HTTP, the raw line protocol and the launcher's options: docs/connecting.md.

Commands

help <command> in the game gives a command's full form. Commands take an entity as e<id> or by its tag or custom name as @<name>. docs/commands.md is the reference, and docs/command-language.md covers scripts, waits and assertions.

Group Command What it does
perception status Position, health, what the crosshair is on
look Blocks and entities around the player
entity One entity's position, motion and updates
find Nearest blocks or entities by id, tag, pattern or block state
block One block's state and light
blocks The blocks in a region
inv The inventory
movement face Aim at a position or entity
turn Set the camera's yaw and pitch
move Walk a direction for blocks or ticks
jump Jump
sneak Sneak, or tap sneak
sprint Sprint
fly Fly in creative
goto Walk to a position or entity along a path, through Baritone when it is installed
interact use Use a block, entity or item
attack Hit entities
mine Break blocks by position or type, walking to them through Baritone when it is installed
place Place an item against a block
inventory select Select a hotbar slot or item
swap Swap two inventory slots
drop Drop items
offhand Move an item to the offhand
equip Put on armour
open Open a container
take Take items from the open container
put Put items into the open container
craft Craft through the recipe book
gui screen What is on screen, with its widgets and slots
cursor Move the mouse pointer
click Click a widget, slot or point
close Close the screen
input mouse Press, release or move the mouse
drag Drag with a mouse button
scroll Scroll the mouse wheel
key Press or hold keys and key chords
type Type text
release Let go of held keys, buttons and movement
talk chat Send a chat message
cmd Send a command as the player
session worlds The saved worlds
servers The server list
join Join a world or server
leave Leave the world or server
quit Close the game
respawn Respawn after dying
create Create a test world
snapshot Save and restore a world's state
delete Delete a test world
config Read and change NeoForge and Forge mod configs in memory
integrated server Run a server command and get its output
nbt The data of a block entity or entity
tick Freeze, step or change the game's tick rate
gametest Run the game's own GameTests and report each one
observe screenshot Save frames, bursts and contact sheets, clean of HUD, overlays and effects
camera Render from a placed camera: glide, follow, orbit, zoom and tilt, play a shot list, follow a Sable ship
settle Wait until the chunks in view have loaded
sounds The sounds that started or play now
sound Play a sound on this client, at a position or as an interface sound
messages Chat, action bar and title messages
particles The particles spawned, by type or pattern
option Change video and sound options for a while, or keep every frame clean
pixels Measure the colour of parts of the frame
flicker The brightness of parts of every frame over a time, and how fast they flicker
record Record an MP4 with sound (docs/recording.md)
log The game log
performance perf Capture server, client and network performance
load Simulate a busy server, a slow client or a laggy network
meta help The reference
fmt Text or JSON replies
sub Push events and log lines as they happen
stop Stop all actions
wait Wait some ticks, or until a query matches
sample Read queries every few ticks, alone or during an action
assert Fail the script unless a query matches
if Run a command only when a query matches
sable (docs) sable:list With Sable: the ships and other sub-levels nearby
sable:info A sub-level's pose, speed and height above ground
sable:find Blocks aboard a sub-level
sable:world A position aboard, in the world
sable:plot A world position, aboard a sub-level
sable:tp Put the player aboard, next to a block

See it build

A lighthouse built block by block through Blockpilot, in Minecraft 26.3 with Fabric. Blockpilot also recorded the video, since it can capture the screen and the game's sound. Next to the game are the commands Blockpilot was sent and what it answered.

https://github.com/user-attachments/assets/cfaabba8-f8eb-48d2-9dc7-678127e7bf45

More

Security

  • Player chat reaches agents only from trustedPlayers in config/blockpilot/config.json, empty by default and set in that file only; everyone else's arrives as withheld from=<name>, on screen and in the logs too.
  • agentCommands: "play" in the same file keeps agents from slash commands not in playSlashCommands, other mods' commands not in allowedExtensions, world files, recordings, mod configs, switching servers and quitting.
  • dangerouslyAllowAll: true there turns all of this off, for testing alone only; it is dangerous with other players.
  • Blockpilot can only limit what happens through the game. Keeping the agent off the computer it runs on is the job of the agent's own setup; safety.md shows one for Claude Code.

License

Apache-2.0 or MIT, at your option; see LICENSE-APACHE and LICENSE-MIT. Neither license covers the name Blockpilot: forks need a name of their own.

Baritone, which goto and mine walk through when the player has installed it, is cabaletta's, under LGPL-3.0. Blockpilot neither ships it nor compiles against it: it calls Baritone's public API at run time. Only dev runs with -Pblockpilot.baritone fetch it, from cabaletta's GitHub releases, checked against their checksums.

Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft.