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

TypeError: Cannot set properties of undefined (setting 'height') #3281

Open
1 task done
anxxxd opened this issue Jan 12, 2024 · 5 comments
Open
1 task done

TypeError: Cannot set properties of undefined (setting 'height') #3281

anxxxd opened this issue Jan 12, 2024 · 5 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 waiting info from op

Comments

@anxxxd
Copy link

anxxxd commented Jan 12, 2024

  • The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 4.17.0
  • server: 1.16.5, Paper(Velocity)
  • node: 18.18.2

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

const mineflayer = require("mineflayer");

function startBot(username) {
    const bot = mineflayer.createBot({
        username: username,
        host: 'mc.reallyworld.ru',
        port: '',
        version: '1.16.5',
    });
}
startBot("botbotbot")

Expected behavior

So that the bot can just log in to the server.

Additional context

Add any other context about the problem here.

@anxxxd anxxxd 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 Jan 12, 2024
@wgaylord
Copy link
Contributor

wgaylord commented Jan 12, 2024

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?

@extremeheat
Copy link
Member

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

@anxxxd
Copy link
Author

anxxxd commented Jan 13, 2024

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

@anxxxd anxxxd reopened this Jan 13, 2024
@extremeheat
Copy link
Member

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).

@anxxxd
Copy link
Author

anxxxd commented Jan 13, 2024

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. (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)

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 waiting info from op
Projects
None yet
Development

No branches or pull requests

3 participants