PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.95k stars 904 forks source link

Cannot move using packets on proxy #965

Closed AkosMaster closed 4 years ago

AkosMaster commented 4 years ago

`

        delta = 0.1
newPosition = lastPosition;
newPosition.x += Math.random() > 0.5 ? delta : -delta;
newPosition.y += Math.random() > 0.5 ? delta : -delta;
newPosition.z += Math.random() > 0.5 ? delta : -delta;

client.write("position", newPosition);

lastPosition = newPosition;

`

this is what I'm using to do antiafk from my proxy client. The server either teleports me back or I just don't appear to move at all. I am interested in how other libraries achieved movement with packets. If anyone knows a reliable method, please help.

(lastPosition is always the last position packet the server sent me) I am on 1.12.2

imharvol commented 4 years ago

Mineflayer has its own physics plugin that already send a position_look packet, so you can try to modify the bot.entity.position instead of sending the packet yourself