Skip to content

Track the abilities the server grants - #4083

Merged
rom1504 merged 1 commit into
PrismarineJS:masterfrom
u9g:feat/player-abilities
Sep 14, 2026
Merged

Track the abilities the server grants#4083
rom1504 merged 1 commit into
PrismarineJS:masterfrom
u9g:feat/player-abilities

Conversation

@u9g

@u9g u9g commented Sep 7, 2026

Copy link
Copy Markdown
Member

Closes #1587. Half of #3274.

Nothing in lib/ reads the clientbound abilities packet, so the flight, invulnerability and speeds a server hands out are invisible to a bot. The visible consequence is #3274: the capture there shows a vanilla client hovering after an abilities packet with the flying bit while mineflayer keeps falling, and the server's anti-bot check kicks it for exactly that difference.

  • bot.abilities{ invulnerable, flying, mayFly, instantBuild, flyingSpeed, walkingSpeed }, starting at Abilities' own defaults (0.05 / 0.1) until the server sends the packet.
  • bot.entity.flying and bot.entity.flyingSpeed carry the flight state to prismarine-physics, which reads them in Obey the flight the server grants in the abilities packet prismarine-physics#142. Until that is released the state is just visible, not acted on; with it the bot hovers like vanilla.
  • An abilities event fires on each update.

Flag bits are ClientboundPlayerAbilitiesPacket's (1 invulnerable, 2 flying, 4 can-fly, 8 instabuild); the packet's shape is identical from 1.8 through 26.1.

Test in test/internalTest.js checks the defaults before the packet and each field after one; it does not pass on master, where bot.abilities is undefined. The 21 switchWorld respawn failures in the internal suite are already there on master.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Tests more than 2x slower than master (durations are noisy, so this is informational):

   7519ms ->   18770ms  mineflayer_external 1.21.9v nether

@u9g u9g mentioned this pull request Sep 12, 2026
Nothing read the abilities packet, so the flight, invulnerability and speeds the
server hands out were invisible and the bot kept falling through air the server
had it flying in. bot.abilities holds the packet's state, entity.flying and
entity.flyingSpeed carry it to prismarine-physics, and an 'abilities' event
fires on each update.
@u9g
u9g force-pushed the feat/player-abilities branch from caf2555 to 05c09e1 Compare September 12, 2026 18:00
@rom1504
rom1504 merged commit 2b2505b into PrismarineJS:master Sep 14, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Player Abilities

3 participants