Skip to content

Send Client Information (settings) packet during configuration phase#1499

Open
AChompSitsIn wants to merge 2 commits into
PrismarineJS:masterfrom
AChompSitsIn:fix/3623-config-settings
Open

Send Client Information (settings) packet during configuration phase#1499
AChompSitsIn wants to merge 2 commits into
PrismarineJS:masterfrom
AChompSitsIn:fix/3623-config-settings

Conversation

@AChompSitsIn

Copy link
Copy Markdown

On 1.20.2+ the vanilla client sends Client Information (settings) during the
configuration phase; node-minecraft-protocol never does. Servers that gate
finish_configuration on it (e.g. Hypixel) never advance and drop the client
with socketClosed right after login_acknowledged — so bots can't join on
1.20.2–1.21.x.

Fix: write settings immediately after the CONFIGURATION state flip in
enterConfigState (inside the existing hasConfigurationState branch, so 1.20.2+
only). particleStatus (1.21.2+) is omitted so one payload serializes on every
config-phase version.

Supersedes #1402, which wrote the packet before the state flip (still login
state → serialization error → CI failed on exactly 1.20.2–1.21.4).

Tested: lint, serverTest (319), packet/cyclePacket (5983), and real-server
clientTest on 1.21.4 + 1.21.9 all pass. mineflayer joins Hypixel 1.21.9 with this
change; socketClosed without.

Fixes PrismarineJS/mineflayer#3623

@extremeheat extremeheat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mineflayer on login does send its own settings, so sending them inside nmp can conflict with mineflayer's own settings.

How does this PR handle that?

Comment thread src/client/play.js
Comment on lines +60 to +69
client.write('settings', {
locale: 'en_us',
viewDistance: 10,
chatFlags: 0,
chatColors: true,
skinParts: 127,
mainHand: 1,
enableTextFiltering: false,
enableServerListing: true
})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be configurable parameters

@AChompSitsIn

Copy link
Copy Markdown
Author

Good points, thanks.

On the conflict with mineflayer's settings: there isn't one. This mirrors the vanilla client, which sends Client Information in both the configuration and play phases. The config-phase send only exists to unblock servers (like Hypixel) that won't send finish_configuration until they receive it. mineflayer's existing play-state send (bot._client.on('login', ...)) still runs afterward and stays authoritative for the user's bot.settings; last write wins, and the config-phase values don't affect gameplay (no world/chunks exist yet during configuration). So mineflayer users keep their configured settings; this just lets the handshake complete on strict servers. Raw node-minecraft-protocol clients (no play-phase send) now get sane defaults, which is the actual fix.

On configurability: done. The values now come from a clientSettings option (documented in docs/API.md), each field defaulting to a vanilla-safe value:

createClient({
  // ...
  clientSettings: { viewDistance: 4, locale: 'en_gb', mainHand: 0 } // any subset
})

If you'd prefer, mineflayer can pass its bot.settings-derived values through as clientSettings in a follow-up so the config-phase and play-phase sends are byte-identical, but that's optional since the play-phase send already applies them.

Tested: lint, serverTest (319), packetTest/cyclePacketTest (5983), and real vanilla-server clientTest on 1.21.4 + 1.21.9 all pass.

@AChompSitsIn AChompSitsIn requested a review from extremeheat June 29, 2026 02:37
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.

Mineflayer doesn't send configuration.settings packet at login, causing some servers to disconnect the user

2 participants