# Minecraft AI World

This is a Claude Code workspace for interacting with a Minecraft Bedrock world via the mc-ai-bridge MCP server.

## Multi-World Architecture

Four Bedrock servers on `10.0.0.247`, connected via native `/transfer` (no proxy):

| Server | Port | Purpose |
|--------|------|---------|
| Lobby  | 19132 | Main entry point (adventure mode) |
| Jamie  | 19133 | Jamie's survival world |
| Lyla   | 19134 | Lyla's survival world |
| Mya    | 19135 | Mya's survival world |

Players connect to `10.0.0.247:19132` (lobby) and use portal zones to transfer to child worlds.
Child worlds have a hub-return addon (compass, `!hub`/`!lobby` commands, portal zone) to transfer back.

### Transfer Mechanism

Transfers use `@minecraft/server-admin` beta API (`transferPlayer()` function). This requires:
- **Beta APIs experiment** enabled in each world's `level.dat` (`gametest` experiment flag)
- `@minecraft/server-admin` v1.0.0-beta dependency in manifest.json
- `permissions.json` allowing `@minecraft/server-admin`

The behavior packs are **bind-mounted** from the host project directory into Docker containers.
Deploy path on server: `/home/sysadmin/minecraft-multiworld/`

## Connection

The mc-ai-bridge runs at `10.0.0.247`:
- **WebSocket** (Minecraft → Bridge): port `3001`
- **MCP HTTP** (Claude → Bridge): port `3002`

To connect Minecraft Bedrock to the bridge, run this command in-game:
```
/connect 10.0.0.247:3001
```

## Available MCP Tools

### `minecraft_command`
Execute any slash command in Minecraft. Do NOT include the leading `/`.
- `command` (string): e.g. `"give @p diamond 64"`, `"tp @p 100 64 200"`, `"time set night"`

### `minecraft_chat`
Send a chat message visible in Minecraft.
- `message` (string): The message to send
- `player` (string, optional): Target player for `/tell`. Omit to broadcast with `/say`.

### `minecraft_build`
Execute a batch of build commands with rate limiting. Max 200 commands per call. Only `setblock`, `fill`, `clone`, and `structure` commands are allowed.
- `commands` (string[]): e.g. `["setblock 10 64 10 stone", "fill 10 64 10 20 64 20 glass"]`

### `minecraft_get_events`
Get recent game events from the in-memory event buffer.
- `count` (number, optional): Number of events to return (default 20, max 100)
- `type` (string, optional): Filter by event type, e.g. `"PlayerMessage"`, `"BlockChanged"`

### `minecraft_get_status`
Check if Minecraft is connected and get status info (player name, uptime, subscriptions, queue stats). No parameters.

### `minecraft_subscribe`
Subscribe to Bedrock event types. Available events:
`PlayerMessage`, `BlockChanged`, `PlayerTransform`, `ItemUsed`, `ItemAcquired`, `ItemCrafted`, `MobKilled`, `MobInteracted`, `PlayerTravelled`, `PlayerDied`, `BossKilled`

- `event` (string): Event type to subscribe to

## Tips

- Always call `minecraft_get_status` first to verify Minecraft is connected before issuing commands.
- Subscribe to `PlayerMessage` to receive chat from the player.
- Use `minecraft_build` for multi-block constructions — it handles rate limiting automatically.
- Coordinates in Minecraft are (X, Y, Z) where Y is vertical height.
