Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resourcepack receive error related to minecraft-data? #3377

Open
Emibergo02 opened this issue May 10, 2024 · 3 comments
Open

Resourcepack receive error related to minecraft-data? #3377

Emibergo02 opened this issue May 10, 2024 · 3 comments
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f

Comments

@Emibergo02
Copy link

Emibergo02 commented May 10, 2024

Versions

  • mineflayer: 4.18.0
  • server: paper 1.20.4
  • bun: 1.1.8

Detailed description of a problem

43 |     }]
44 |   },
45 |   Write: {
46 |     varlong: ['native', minecraft.varlong[1]],
47 |     UUID: ['native', (value, buffer, offset) => {
48 |       const buf = value.length === 32 ? Buffer.from(value, 'hex') : UUID.parse(value)
                       ^
TypeError: Serialization error for play.toServer : Write error for undefined : undefined is not an object (evaluating 'value.length')
      at /home/unnm3d/buntest/node_modules/minecraft-protocol/src/datatypes/compiler-minecraft.js:48:19
      at packet_resource_pack_receive (:1206:16)
      at packet (:1419:9)
      at tryCatch (/home/unnm3d/buntest/node_modules/protodef/src/utils.js:50:16)
      at createPacketBuffer (/home/unnm3d/buntest/node_modules/protodef/src/compiler.js:102:5)
      at _transform (/home/unnm3d/buntest/node_modules/protodef/src/serializer.js:18:13)
      at /home/unnm3d/buntest/node_modules/protodef/node_modules/readable-stream/lib/_stream_transform.js:166:5
      at /home/unnm3d/buntest/node_modules/protodef/node_modules/readable-stream/lib/_stream_transform.js:155:78
      at doWrite (/home/unnm3d/buntest/node_modules/protodef/node_modules/readable-stream/lib/_stream_writable.js:390:132)
      at writeOrBuffer (/home/unnm3d/buntest/node_modules/protodef/node_modules/readable-stream/lib/_stream_writable.js:381:5)

seems to be related to the packet_resource_pack_receive and the method bot.acceptResourcePack();
AND I think this is the cause
https://github.com/PrismarineJS/minecraft-data/blob/c658e8be5c2ce1b4e0478bbfc9f96c3b832fcbce/data/pc/1.20.3/protocol.json#L1951
The packet is not as it was supposed to be here
https://wiki.vg/Protocol#Add_Resource_Pack_.28play.29

What did you try yet?

Check the client's protocol version on the server (it is correct 1.20.3 because 1.20.3 and 1.20.4 have the same protocol
checking the bot version (1.20.4 as defined in createBot)
I checked bot.supportFeature('resourcePackUsesUUID')
It is false but it should be true I think

Your current code

            bot.on("resourcePack", (url, uuid, hash) => {
                bot.acceptResourcePack();
            });

Expected behavior

send a successfully loaded packet to the server

@Emibergo02 Emibergo02 added possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f labels May 10, 2024
@Emibergo02
Copy link
Author

Emibergo02 commented May 10, 2024

bot.supportFeature('resourcePackUsesUUID') was the problem
it returns false but should be true actually .
i fixed the issue by using minecraft-protocol instead of acceptResourcePack()

bot._client.write('resource_pack_receive', {
     uuid: uuid,
     result: 0
})

@extremeheat
Copy link
Member

Can you open a PR to fix?

@Emibergo02
Copy link
Author

Emibergo02 commented May 13, 2024

Can you open a PR to fix it, please?
I don't know how to fix that :(
right now I'm using ViaBackwards with mineflayer 4.17.0 because 4.18.0 doesn't work at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f
Projects
None yet
Development

No branches or pull requests

2 participants