Skip to content

Fix resource pack UUID serialization causing server kick on 1.21+#3842

Open
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-resource-pack-kick-issue
Open

Fix resource pack UUID serialization causing server kick on 1.21+#3842
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-resource-pack-kick-issue

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

  • Fix latestUUID storage: store raw bytes (data.uuid) not UUID object, in both add_resource_pack and resource_pack_send handlers
  • Fix denyResourcePack double-write bug
  • Remove all feature branching from acceptResourcePack and denyResourcePack — protodef ignores extraneous fields so version checks are unnecessary
  • Move latestUUID and latestHash assignments outside the if/else in resource_pack_send so both are always stored
  • Lint passes, CodeQL: 0 alerts
Original prompt

This section details on the original issue you should resolve

<issue_title>Kicks from the server when receiving a resource pack.</issue_title>
<issue_description>- [ ] The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 4.33.0
  • server: BungeeCord 1.21-R0.4 - Paper
  • node: 24.1.0

Detailed description of a problem

There are no problems when logging into the hub, but when connecting to a subserver on version 1.21, the server offers a resource pack, but the problem is I can't accept or decline it. Either way, I get kicked from the server for no reason.

Your current code

import mineflayer from "mineflayer";

const bot = mineflayer.createBot({
    host: 'neo.funtime.sh',
    port: 25565,
    username: '6055_42',
    version: '1.21.8'
});

bot.on('spawn', () => {
    console.log('Join to anarchy')
    bot.chat("/an11") // Joining a server with version 1.21 from the lobby (BungeeCord)
})
bot.on('resourcePack', () => {
    console.log('Resource pack received');
    bot.acceptResourcePack();
    console.log('Resource pack accepted');
})
bot.on('message', (message) => {
    console.log(`${message.toString()}`)
})
bot.on('kicked', (reason) => {
    console.log('Kicked:', reason);
})
bot.on('error', (error) => {
    console.error(`Error: ${error}`);
})
bot.on('end', (reason) => {
    console.log(`End: ${reason}`);
})

Expected behavior

Successful connection to the server without kicking; resource pack is not important.
</issue_description>

<agent_instructions>Add the code posted by MayorLeon20 to our acceptResourcePack handling</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@extremeheat acceptResourcePack needs to be fixed and simplify

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: extremeheat <13713600+extremeheat@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix kick issue when receiving resource pack from server Fix resource pack UUID serialization causing server kick on 1.21+ Feb 27, 2026
@MayorLeon20
Copy link

everything is cool

@extremeheat extremeheat marked this pull request as ready for review February 27, 2026 12:14
Copy link
Member

Choose a reason for hiding this comment

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

This branch is unnecessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the branch — denyResourcePack now unconditionally writes a single packet with uuid included. Done in 708fd6f.

}
})

function acceptResourcePack () {
Copy link
Member

Choose a reason for hiding this comment

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

These branches are also unnecessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed all feature branching from acceptResourcePack — it now always writes both packets with uuid and hash fields unconditionally (protodef drops fields not in the version's schema). Done in 708fd6f.

@extremeheat
Copy link
Member

@copilot since protodef will ignore extraneous fields for versions that don't have them, the feature branching is unnecessary. Feature branching is only needed for fields that have different non-null data types between different versions; using different field names removes this need. You can remove them where applicable for cleanliness (sometimes it's helpful to have comments aside fields to notate what version the field applies to)

…branching

Co-authored-by: extremeheat <13713600+extremeheat@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 27, 2026

@copilot since protodef will ignore extraneous fields for versions that don't have them, the feature branching is unnecessary. Feature branching is only needed for fields that have different non-null ...

Done in 708fd6f. Removed all feature branching from acceptResourcePack and denyResourcePack. Also moved the latestUUID and latestHash assignments in resource_pack_send outside the if/else so both are always stored regardless of version.

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.

Kicks from the server when receiving a resource pack.

3 participants