function inject (bot) { bot.position = { x: null, y: null, z: null, yaw: null, pitch: null } // to prevent errors i guess bot.on('packet.position', (packet) => { const oldPos = { ...bot.position } bot.position.x = packet.x + bot.position.x * !!(packet.flags & 1) bot.position.y = packet.y + bot.position.y * !!(packet.flags & 2) bot.position.z = packet.z + bot.position.z * !!(packet.flags & 4) bot.position.yaw = packet.yaw + bot.position.yaw * !!(packet.flags & 8) bot.position.pitch = packet.pitch + bot.position.pitch * !!(packet.flags & 16) bot._client.write('teleport_confirm', { teleportId: packet.teleportId }) bot.emit('move', oldPos) }) } module.exports = inject