Recording Tests
FlintCLI includes a recording mode that captures your in-game actions and generates test files automatically. This is the fastest way to create tests without writing JSON manually.
Starting a Recording
Section titled “Starting a Recording”- Start FlintCLI in interactive mode:
flintmc -s localhost:25565 -i- In-game, type the record command:
!record my_test_name- The bot will announce that recording has started and freeze game time.
Recording Workflow
Section titled “Recording Workflow”Once recording starts:
- Place blocks - All block changes are captured with their tick timing
- Advance ticks - Use
!tickor!tick <count>to step forward - Add assertions - Use
!assertto verify current block states - Save the test - Use
!savewhen done
Recording Commands
Section titled “Recording Commands”| Command | Description |
|---|---|
!tick | Advance one game tick |
!tick <n> | Advance n game ticks |
!assert | Assert all changes since last assert |
!assert_changes | Assert only blocks that changed |
!save | Save and finish recording |
!cancel | Discard recording |
Example Recording Session
Section titled “Example Recording Session”Player: !record fence_testBot: Recording started for 'fence_test'. Game time frozen.
[Player places an oak fence at 0, 100, 0]
Player: !tickBot: Tick 1
[Player places a stone block next to the fence at 1, 100, 0]
Player: !tickBot: Tick 2
Player: !assertBot: Added 2 assertions at tick 2
Player: !saveBot: Test saved to fence_test.jsonGenerated Test Structure
Section titled “Generated Test Structure”Recording generates a complete test file:
{ "flintVersion": "0.1", "name": "fence_test", "setup": { "cleanup": { "region": [[-5, 95, -5], [5, 105, 5]] } }, "timeline": [ { "at": 0, "do": "place", "pos": [0, 100, 0], "block": { "id": "minecraft:oak_fence" } }, { "at": 1, "do": "place", "pos": [1, 100, 0], "block": { "id": "minecraft:stone" } }, { "at": 2, "do": "assert", "checks": [ { "pos": [0, 100, 0], "is": { "id": "minecraft:oak_fence", "state": { "east": "true" } } }, { "pos": [1, 100, 0], "is": { "id": "minecraft:stone" } } ] } ]}Cleanup Region
Section titled “Cleanup Region”The recording automatically calculates a cleanup region that encompasses all placed blocks with padding. You can edit this in the generated JSON if needed.
Tick Timing
Section titled “Tick Timing”- Use
!tickfrequently to capture precise timing - Redstone mechanics often need multiple ticks to propagate
- Water and lava flow requires many ticks (check timing in generated tests)
Assertions
Section titled “Assertions”!assertcaptures the complete state of all placed blocks!assert_changesonly captures blocks that changed since the last assertion- You can add multiple assertions at different tick points
Editing Generated Tests
Section titled “Editing Generated Tests”Recording creates a good starting point, but you may want to:
- Add tags for organization
- Add a description
- Adjust the cleanup region
- Add breakpoints for debugging
Contributing to FlintBench
Section titled “Contributing to FlintBench”Tests that validate vanilla Minecraft behavior should be contributed to FlintBench, the official test collection. After recording a test:
- Fork the FlintBenchmark repository
- Place your test in the appropriate category folder
- Run
npm run formatto format the JSON - Submit a pull request
Next Steps
Section titled “Next Steps”- FlintBench - Contribute your tests to the official collection
- FlintCLI Reference - Complete command reference
- Test Format - Understand the generated JSON format