Control Minecraft entirely from your terminal, scripts, or external applications via a powerful HTTP REST API.
Body / Full Description
API Bridge is a powerful Fabric mod for Minecraft 1.21.11 that exposes an internal HTTP REST API. It allows you to programmatically control almost every aspect of the game—from client UI interactions to player movements, world settings, and block manipulation—directly from your terminal, Python scripts, or Node.js applications without ever touching your keyboard or mouse!
Key Features
Complete Client Automation: Simulate keyboard inputs (WASD, sprint, jump) and UI interactions (e.g., automatically click the "Singleplayer" button).
Player & World Control: Teleport, change look direction (pitch/yaw), swing hands, change the time of day, and toggle weather conditions.
Inventory & Block Manipulation: Place or break blocks anywhere, drop items, change selected hotbar slots, and manage your inventory on the fly.
Scripting & Macros System: Send a list of commands to execute sequentially for advanced automation (like building an auto-mining bot).
Language Agnostic: If it can send an HTTP request, it can control Minecraft! Easily integrate with curl, Python, JavaScript, or any language you prefer.
Whether you want to build automated bots, test game mechanics, or create custom external controllers, MC API Mod provides the ultimate programmatic interface for Minecraft.
## v1.2.3 — RLE Depth-Map + Sparse Inventory
### Enhancements
- **`viewport_blocks` now uses RLE compression** — Previously 288 ints (144 flat [depth, blockId] pairs). Now consecutive identical rays are merged into runs: `[[count, depth, blockId], ...]`. Typical scene: ~40-60% fewer tokens vs. flat format. Empty state returns `[]`.
- **`inventory.slots` now sparse** — Previously 41 fixed `[item_id, count]` entries (82 ints + JSON overhead). Now only non-empty slots are included, each as `[slot_index, item_id, count]`. Empty state returns `[]`. Early-game saving: ~6-15 token vs 165.
## v1.2.2 — Depth-Map with Surface Block IDs
### Enhancements
- **`viewport_blocks` now returns `[depth, blockId]` pairs** — Previously a flat depth-only array (144 ints). Now each of the 144 rays produces two values: depth (1–32 = distance to nearest solid) and the numeric block ID of that surface block (0 if clear). Total 288 ints.
- AI can now distinguish stone vs. dirt vs. water at each ray without a separate API call.
### Bug Fixes
- **Fixed stride in viewport_blocks doc** — Index formula corrected from `depth * 288` to `depth * 144` (each depth layer has 16×9 = 144 cells, not 288).
- **`viewport_entities` no longer pads empty slots** — Removed 16-slot fixed-size padding. Returns only actual visible entities (0–16 elements).
## v1.2.1 — Registry Endpoints + Bug Fixes
### New Features
- **Registry Dump Endpoints** — Two new runtime endpoints for resolving numeric IDs:
- `GET /api/registry/entities` — Dumps `id → "minecraft:name"` from `BuiltInRegistries.ENTITY_TYPE`
- `GET /api/registry/items` — Dumps `id → "minecraft:name"` from `BuiltInRegistries.ITEM`
- AI agents can call these once per session for accurate ID lookup, eliminating hardcoded tables.
### Bug Fixes
- **`world.time` clamping** — Observation now returns `dayTime % 24000` (range 0–24000) as documented, instead of raw tick value. Fixes `ObservationProvider.java:143`.
- **`viewport_entities` FOV filtering** — Entities are now filtered by the player's actual field of view (frustum cone). Previously all entities within 48 blocks were included regardless of direction. Fixes `ObservationProvider.java:363-371`.
- **Entity ID table in docs** — Both `OBSERVATION_SCHEMA.md` and `AI_AGENT_GUIDE.md` entity type ID tables updated to match the real Minecraft 1.21.11 registry order (from `BuiltInRegistries.ENTITY_TYPE`).
- **API.md doc updates** — Added documentation for registry endpoints; updated `viewport_entities` description to clarify frustum filtering.