2024-11-22 12:49:22 -05:00
|
|
|
function position (context) {
|
|
|
|
const bot = context.bot;
|
2024-12-06 11:04:23 -05:00
|
|
|
bot.position = null;
|
2024-07-07 15:44:16 -04:00
|
|
|
|
|
|
|
bot.on('packet.position', packet => {
|
|
|
|
bot.position = {
|
|
|
|
x: packet.flags & 1 ? (this.x + packet.x) : packet.x,
|
|
|
|
y: packet.flags & 2 ? (this.y + packet.y) : packet.y,
|
|
|
|
z: packet.flags & 4 ? (this.z + packet.z) : packet.z
|
2024-12-06 11:04:23 -05:00
|
|
|
};
|
2024-07-07 15:44:16 -04:00
|
|
|
|
|
|
|
bot._client.write('teleport_confirm', { teleportId: packet.teleportId })
|
|
|
|
|
|
|
|
bot.emit('move')
|
|
|
|
})
|
|
|
|
|
|
|
|
bot.on('end', () => { bot.position = null })
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = position
|