Open anxxxd opened 10 months ago
To me this looks like somehow the client is trying to set the height field of bot.entity when bot.entity is null. (which doesn't make much sense since that is set on the login packet.)
Now it could be the server lobby is doing something weird in regards to the packets its sending that mineflayer can't deal with but vanilla clients can. Any details about the server you can share?
Please enable debug logging and post the console output. You can do that by adding
process.env.DEBUG = 'minecraft-protocol'
To the top of your script
I added process.env.DEBUG = 'minecraft-protocol', but nothing has changed, as soon as I run the JS script, it stops working for the same reason..
bot.entity.height = 1.62 ^ TypeError: Cannot set properties of undefined (setting 'height') at Client. (C:\Users\anxxd\Desktop\DXN\node_modules\mineflayer\lib\plugins\physics.js:335:23) at Client.emit (node:events:517:28) at emitPacket (C:\Users\anxxd\Desktop\DXN\node_modules\minecraft-protocol\src\client.js:83:12) at FullPacketParser. (C:\Users\anxxd\Desktop\DXN\node_modules\minecraft-protocol\src\client.js:112:9) at FullPacketParser.emit (node:events:517:28) at addChunk (C:\Users\anxxd\Desktop\DXN\node_modules\protodef\node_modules\readable-stream\lib_stream_readable.js:279:12) at readableAddChunk (C:\Users\anxxd\Desktop\DXN\node_modules\protodef\node_modules\readable-stream\lib_stream_readable.js:262:11) at Readable.push (C:\Users\anxxd\Desktop\DXN\node_modules\protodef\node_modules\readable-stream\lib_stream_readable.js:228:10) at Transform.push (C:\Users\anxxd\Desktop\DXN\node_modules\protodef\node_modules\readable-stream\lib_stream_transform.js:132:32) at FullPacketParser._transform (C:\Users\anxxd\Desktop\DXN\node_modules\protodef\src\serializer.js:89:10)
p.s. sorry for closing issue, missed the button
Nothing is supposed to change, it's supposed to log data to the console. If it did not then you did not addd it correctly like I said (to the top of your script).
sorry, I really put it in the wrong place, here are the logs from the console with the debug minecraft-protocol writing packet handshaking.set_protocol +0ms minecraft-protocol { minecraft-protocol protocolVersion: 754, minecraft-protocol serverHost: 'mc.reallyworld.ru', minecraft-protocol serverPort: 25565, minecraft-protocol nextState: 2 minecraft-protocol } +1ms minecraft-protocol writing packet login.login_start +17ms minecraft-protocol { minecraft-protocol username: 'botbotbot', minecraft-protocol signature: null, minecraft-protocol playerUUID: '1ec52be4-28de-34d0-8fd5-8f525e338650' minecraft-protocol } +0ms minecraft-protocol read packet login.compress +7s minecraft-protocol { minecraft-protocol "threshold": 0 minecraft-protocol } +0ms minecraft-protocol read packet login.success +3ms minecraft-protocol { minecraft-protocol "uuid": "1ec52be4-28de-34d0-8fd5-8f525e338650", minecraft-protocol "username": "botbotbot" minecraft-protocol } +0ms minecraft-protocol read packet play.position +39ms minecraft-protocol { minecraft-protocol "x": 7, minecraft-protocol "y": 450, minecraft-protocol "z": 7, minecraft-protocol "yaw": 90, minecraft-protocol "pitch": 38, minecraft-protocol "flags": 0, minecraft-protocol "teleportId": 9876 minecraft-protocol } +0ms C:\Users\anxxd\Desktop\DXN\node_modules\mineflayer\lib\plugins\physics.js:335 bot.entity.height = 1.62 ^
TypeError: Cannot set properties of undefined (setting 'height')
at Client.
Versions
Detailed description of a problem
When I launch the bot to the server, I get a crash and a height-related error in response. I think this is due to checking for cheats in the server lobby.
This is the error: TypeError: Cannot set properties of undefined (setting 'height') at Client. (C:\Users\anxxd\Desktop\DXN\node_modules\mineflayer\lib\plugins\physics.js:335:23)
at Client.emit (node:events:517:28)
at emitPacket (C:\Users\anxxd\Desktop\DXN\node_modules\minecraft-protocol\src\client.js:83:12)
at FullPacketParser. (C:\Users\anxxd\Desktop\DXN\node_modules\minecraft-protocol\src\client.js:112:9)
at addChunk (C:\Users\anxxd\Desktop\DXN\node_modules\protodef\node_modules\readable-stream\lib_stream_readable.js:279:12)
at readableAddChunk (C:\Users\anxxd\Desktop\DXN\node_modules\protodef\node_modules\readable-stream\lib_stream_readable.js:262:11)
at Readable.push (C:\Users\anxxd\Desktop\DXN\node_modules\protodef\node_modules\readable-stream\lib_stream_readable.js:228:10)
at Transform.push (C:\Users\anxxd\Desktop\DXN\node_modules\protodef\node_modules\readable-stream\lib_stream_transform.js:132:32)
at FullPacketParser._transform (C:\Users\anxxd\Desktop\DXN\node_modules\protodef\src\serializer.js:89:10)
What did you try yet?
Change version of protocol, add "if(!bot.entity) { bot.entity = {} }". In general, no matter what I did, it didn't help. In other servers everything is ok/
Did you try any method from the API? Yeap, but nothing helped Did you try any example? Any error from those? Same error.
Your current code
Expected behavior
So that the bot can just log in to the server.
Additional context
Add any other context about the problem here.