Minecraft E2E Testing Skill
This skill enables you to control a Minecraft client for end-to-end testing of mods built with the Redstone Dart framework.
Prerequisites
The Minecraft MCP server must be configured in Claude Code settings. It does NOT need a mod path at startup - you provide that when starting Minecraft.
Starting Minecraft
To start Minecraft for testing, call startMinecraft with the absolute path to your mod:
startMinecraft(modPath: "/absolute/path/to/your/mod")
What happens automatically:
- Builds the mod with
redstone run - Creates and loads a superflat test world (
dart_visual_test) - Starts the MCP game server inside Minecraft
- Runs in background mode (won't steal window focus)
- Disables hot reload for stability
Just provide the mod path and everything else is handled!
Available Tools
When the Minecraft MCP is connected, you have access to these tools:
Lifecycle Management
startMinecraft(modPath)- Start Minecraft with the specified mod (provide absolute path)stopMinecraft- Stop the Minecraft clientgetStatus- Check if Minecraft is running
Debugging
getLogs(lastN?)- Get all output (Dart prints, Java logs, stderr). Default: last 100 lines.
World Operations
placeBlock(x, y, z, blockId)- Place a block at coordinatesgetBlock(x, y, z)- Get block ID at coordinatesfillBlocks(fromX, fromY, fromZ, toX, toY, toZ, blockId)- Fill a region with blocks
Entity Operations
spawnEntity(entityType, x, y, z)- Spawn an entitygetEntities(centerX, centerY, centerZ, radius)- Find entities in radius
Player & Camera
teleportPlayer(x, y, z)- Teleport the playerpositionCamera(x, y, z, yaw, pitch)- Set camera position and rotationlookAt(x, y, z)- Make camera look at a position
Visual Verification
takeScreenshot(name)- Capture a screenshotgetScreenshot(name)- Get screenshot as base64 data
Input Simulation
pressKey(keyCode)- Press a keyboard keyclick(button, x, y)- Click mouse at screen coordinates (button: 0=left, 1=right, 2=middle)holdMouse(button)- Hold mouse button down (for breaking blocks, using items)releaseMouse(button)- Release held mouse buttonmoveMouse(x, y)- Move cursor to screen coordinatesscroll(horizontal, vertical)- Scroll mouse wheel (positive vertical = scroll up)typeText(text)- Type text into input field
Time & Commands
waitTicks(ticks)- Wait for game ticks (20 ticks = 1 second)setTimeOfDay(time)- Set game time (0=dawn, 6000=noon, 12000=dusk, 18000=midnight)executeCommand(command)- Run any Minecraft command
Testing Workflow
1. Start Minecraft
First, ensure Minecraft is running by checking status or starting it.
2. Set Up Test Environment
- Teleport player to test location
- Clear area with fillBlocks using air
- Set time of day for consistent lighting
- Wait for world to stabilize
3. Perform Test Actions
- Place blocks to test
- Spawn entities
- Simulate player input
- Execute commands
4. Verify Results
- Check block states with getBlock
- Query entities with getEntities
- Take screenshots for visual verification
5. Clean Up
- Remove test blocks/entities
- Reset player position if needed
Common Test Patterns
Testing Block Placement
1. teleportPlayer to test area
2. fillBlocks to clear area (use minecraft:air)
3. waitTicks(20) for world update
4. placeBlock with your custom block
5. waitTicks(5)
6. getBlock to verify placement
7. takeScreenshot for visual record
Testing Custom Entities
1. Set up clear test area
2. spawnEntity with your custom entity type
3. waitTicks(20) for entity to initialize
4. getEntities to verify spawn
5. takeScreenshot to capture entity appearance
Testing UI/Screens
1. pressKey to open UI (e.g., E for inventory)
2. waitTicks(5) for UI to render
3. takeScreenshot
4. click to interact with UI elements
5. pressKey to close UI
Testing Commands
1. executeCommand("give @p minecraft:diamond 64")
2. waitTicks(5)
3. takeScreenshot to verify
Block IDs
Common block IDs:
minecraft:air- Remove blocksminecraft:stone- Stone blockminecraft:dirt- Dirt blockminecraft:grass_block- Grassminecraft:diamond_block- Diamond block
Custom mod blocks use format: modid:block_name
Key Codes
Common key codes for input simulation:
69- E (Inventory)27- Escape32- Space (Jump)87- W (Forward)65- A (Left)83- S (Back)68- D (Right)340- Left Shift (Sneak)
Coordinate System
Modern Minecraft (1.18+) uses an extended height range:
- World extends from Y=-64 to Y=320
- Sea level is approximately Y=63
- Superflat test worlds have ground at Y=-60
When testing in the dart_visual_test world (superflat):
- Ground level: Y=-60
- Player spawn: teleport to Y=-59 or Y=-60
- Place blocks starting at Y=-60
- Spawn entities at Y=-59 (one block above ground)
Block Center Coordinates
Important: Integer coordinates (0, 1, 2, etc.) represent block edges/corners, not block centers. When using lookAt to look at a block, add 0.5 to each coordinate to target the center of the block:
- Block at (10, -60, 20) → Look at (10.5, -59.5, 20.5) to see the center
- Block at (0, 0, 0) → Look at (0.5, 0.5, 0.5) for the center
This is especially important when:
- Taking screenshots of specific blocks
- Verifying block appearance visually
- Positioning the camera to view block details
Tips
- Always wait after actions - Use
waitTicksafter placing blocks, spawning entities, or any world modification - Use executeCommand for complex setups - Commands like
/fill,/summon,/effectcan simplify test setup - Take screenshots liberally - Visual verification helps confirm test results
- Clear test areas first - Use
fillBlockswith air to ensure clean test environment - Check status before testing - Verify Minecraft is running with
getStatus
Example Test Session
Testing a custom diamond sword that deals extra damage (in superflat test world):
1. getStatus - Verify Minecraft running
2. teleportPlayer(100, -59, 100) - Move to test area (standing on ground at Y=-60)
3. fillBlocks(95, -60, 95, 105, -50, 105, "minecraft:air") - Clear area above ground
4. waitTicks(20)
5. executeCommand("give @p mymod:super_sword") - Give custom item
6. spawnEntity("minecraft:zombie", 100, -59, 103) - Spawn test target (on ground)
7. waitTicks(10)
8. takeScreenshot("before_attack")
9. // Simulate attack with click/key presses
10. waitTicks(20)
11. getEntities(100, -59, 100, 10) - Check if zombie was killed
12. takeScreenshot("after_attack")
Source: Norbert515/redstone_dart — distributed by TomeVault.