Commit 3b05f83
Update CI to Node 24 (#3861)
* Update CI to Node 24
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix test flake on Node 24: wait for physics tick before resetState
After the "gamemode after respawn" test kills and respawns the bot,
Node 24's faster event-loop timing causes the physics loop to send a
stale position packet before the server fully processes the respawn,
resulting in "Invalid move player packet received" disconnection.
Add waitForTicks(4) at the start of resetState to let the physics
engine settle into a valid state before sending any commands.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Retrigger CI after node-minecraft-protocol release
* fix: use sleep instead of waitForTicks in resetState to avoid timeout on old MC versions
waitForTicks relies on the physics loop emitting physicsTick events,
but on older MC versions (1.8-1.12) the physics loop may not be active
yet when resetState is called in beforeEach. This caused a 5200ms
timeout and test failures. Using a time-based sleep(200) achieves the
same delay without depending on the physics loop being active.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: try waitForTicks with sleep fallback in resetState
waitForTicks is needed when the physics loop is running (e.g. after
respawn) to properly synchronize before sending commands. But it
times out when the physics loop hasn't started yet on older MC
versions. This change tries waitForTicks first, falling back to a
simple sleep if it times out.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Reduce test flakiness: reconnect, retries, timeouts, cleanup
- Add bot reconnection in beforeEach when bot gets disconnected
(breaks the cascade where one test kick kills all subsequent tests)
- Add --retries 2 to mocha in CI for transient failures
- Increase inner timeout from 20s to 40s in CI environment
- Fix clearInventory listener leak (was adding new listener every call)
- Add afterEach hook to clean up test-specific event listeners
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix reconnection: catch disconnects during resetState, not just before
The bot gets kicked with "Invalid move player packet" during resetState
(not before it), so the beforeEach check for !bot.entity wasn't enough.
Now wraps resetState in try/catch - on failure, reconnects and retries.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Disable physics before /kill to prevent invalid packet kick
The root cause of the cascade: after /kill, the physics loop sends a
stale position packet before the server finishes the respawn, causing
"Invalid move player packet received" kick.
Fix: disable bot.physicsEnabled before /kill in selfKill() and
spawnEvent test, re-enable in resetState after a short delay.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix: delay position response after respawn to prevent server kick
After respawn, the server sends a forced position packet. Mineflayer
was immediately responding with position_look, which older MC servers
(1.8-1.13) reject as "Invalid move player packet received" because
the respawn isn't fully processed yet.
Fix: track justRespawned flag, and on the first forced position packet
after respawn, delay the position_look response by 500ms. This gives
the server time to finish processing the respawn.
This is a real bug fix in the physics plugin, not a test workaround.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Refine: skip position_look after respawn instead of delaying
Instead of a 500ms setTimeout, skip the immediate position_look echo
entirely after respawn. Update internal tracking so the next physics
tick sends the correct position naturally. No added latency.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Clean up: keep only the real fixes, remove experiment cruft
Remove reconnection logic, afterEach cleanup, and sleep(200) that
were experimental workarounds. The physics.js fix is the real solution.
Remaining changes:
- ci.yml: Node 24 + --retries 2
- physics.js: Skip position_look after respawn (real bug fix)
- testCommon.js: Increase timeout to 40s in CI, fix listener leak
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix: disable physics on death, not just respawn
The kick was happening between death and respawn — the physics tick
sent position packets after the bot died but before the respawn packet
arrived. Now shouldUsePhysics is set to false on 'death' event.
Also use timestamp-based window (500ms) instead of a single-use flag,
so ALL forced position responses within 500ms of death/respawn are
skipped, not just the first one.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Emit 'move' event even when skipping position_look after respawn
The teleport helper in tests waits for 'move' event which was only
emitted by sendPacketPositionAndLook. Since we skip that after respawn,
teleports within 500ms of respawn would time out. Now emit 'move' from
the skip path too.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix crafting test: sync wait after gamemode switch + correct metadata
1. Add 500ms wait after becomeSurvival() before crafting, so the server
finishes syncing inventory after the gamemode change. Fixes "Server
rejected transaction" on 1.11-1.12.
2. Use the metadata from recipe data for the log item on pre-flat
versions. The recipe data uses metadata 12 (wildcard) but the test
was giving metadata 0. Fixes "can't make planks" on 1.8.8.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Use event-based wait instead of fixed sleep after gamemode switch
Wait for inventory updateSlot event after becomeSurvival() instead of
a fixed 500ms sleep. The server resends inventory on gamemode change.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix spawnEvent: wait for playerLeft before killing bot
Wait for the second bot's disconnection to be processed by the server
before killing the main bot. The server might not handle /kill properly
while still processing the other player's disconnection.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix crafting: use waitForTicks instead of updateSlot after gamemode switch
The updateSlot event doesn't always fire after gamemode change on older
versions. Use waitForTicks(1) instead — it's event-based (waits for a
physics tick) and gives the server one tick to sync.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix crafting test: use /give in survival mode, fix metadata for old MC
Use /give command after switching to survival to avoid creative→survival
inventory desync. Use item names (not IDs) and include data value for
pre-flat versions.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix crafting test for prismarine-recipe 1.4.0 metadata fix
prismarine-recipe 1.4.0 fixed a mutation bug that was accidentally
making the crafting test pass on 1.8.x. The recipe data for pre-flat
versions uses metadata 12 (wildcard) but the test was giving metadata 0.
Now uses the metadata from the recipe data.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Revert crafting test changes and keep package.json at prismarine-recipe ^1.3.0
The crafting test on 1.8.x fails with prismarine-recipe 1.4.0 because
the mutation fix exposed bad metadata in minecraft-data recipe data.
This needs to be fixed in prismarine-recipe (wildcard metadata handling),
not worked around in the test. Keeping the test as-is for now.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Pin prismarine-recipe to ~1.3.0 until wildcard metadata is fixed
prismarine-recipe 1.4.0 breaks crafting on 1.8.x because the mutation
fix exposed bad wildcard metadata in minecraft-data recipe data.
Pin to 1.3.x until prismarine-recipe handles metadata wildcards.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Use prismarine-recipe fix-wildcard-metadata branch
Point to PrismarineJS/prismarine-recipe#fix-wildcard-metadata which
normalizes recipe ingredient metadata wildcards. This fixes crafting
on pre-1.13 versions where metadata values don't match actual items.
Temporary until prismarine-recipe publishes a new version with the fix.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix: delay position_look 1500ms after death/respawn
On 1.8.x, the server needs ~1s after respawn before accepting
position packets. Use a 1500ms delayed send instead of skipping
entirely (which caused a deadlock where chunks never loaded).
Also use prismarine-recipe GitHub branch for wildcard metadata fix.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix: only set respawnTimer on death, not respawn
The respawn event fires after death, resetting the timer and causing
the teleport forced position in resetState to get delayed too. Only
set the timer on death — one delay per death cycle is enough.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix craft.js: use server's actual result, not recipe metadata
The crafting result in slot 0 was being overwritten with the recipe's
metadata, which can differ from the server's actual result on pre-1.13
(e.g. recipe says metadata 5, server gives metadata 0). Now uses the
server's set_slot result which is already in window.slots[0].
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Revert craft.js to match master
The crafting transaction rejection on 1.11-1.12 is caused by wrong
result metadata in minecraft-data, not by our changes. Keeping craft.js
as-is. The prismarine-recipe wildcard fix handles ingredients correctly;
result metadata needs to be fixed in minecraft-data separately.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Use fixed minecraft-data recipe branch in CI
Add CI step to clone PrismarineJS/minecraft-data#fix-recipe-metadata
which fixes wrong recipe result metadata for pre-1.13 planks.
Temporary until minecraft-data publishes a new version with the fix.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Use released prismarine-recipe 1.5.0 and minecraft-data 3.108.0
Both packages now include the fixes:
- prismarine-recipe: wildcard metadata normalization
- minecraft-data: correct recipe result metadata for pre-1.13
Remove CI workaround for minecraft-data branch.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: rom1504 <rom1504@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent ea66347 commit 3b05f83
File tree
6 files changed
+37
-9
lines changed- .github/workflows
- lib/plugins
- test/externalTests
- plugins
6 files changed
+37
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
418 | 439 | | |
419 | 440 | | |
420 | 441 | | |
| |||
447 | 468 | | |
448 | 469 | | |
449 | 470 | | |
| 471 | + | |
450 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
451 | 477 | | |
452 | 478 | | |
453 | 479 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
132 | | - | |
| 130 | + | |
133 | 131 | | |
134 | 132 | | |
135 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
0 commit comments