PrismarineJS / node-minecraft-protocol

Parse and serialize minecraft packets, plus authentication and encryption.
https://prismarinejs.github.io/node-minecraft-protocol/
BSD 3-Clause "New" or "Revised" License
1.23k stars 239 forks source link

Cannot move using packets on proxy, server either teleports me back or doesnt move #703

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

rom1504 commented 4 years ago

you need to send the position every tick see how mineflayer does it in https://github.com/PrismarineJS/mineflayer/blob/504e8f21a05e2f900bafe66abaf120860b1336f1/lib/plugins/physics.js#L375