chipmunkbot3/plugins/get-entity-pos.js
2024-02-29 22:58:11 -05:00

16 lines
559 B
JavaScript

// const nbt = require('prismarine-nbt')
// const SNBT = require('../util/snbt.js')
// const toNBTUUID = require('./../util/uuid-to-nbt-uuid.js')
function inject (bot) {
bot.getEntityPos = function getEntityPos (selector, callback) {
if (typeof callback !== 'function') throw new Error('the callback must be a function lol')
bot.exploits.execute(`run teleport ${bot.uuid} ${selector}`)
bot._client.once('position', callback)
setTimeout(() =>
bot._client.removeListener('position', callback)
, 3000)
}
}
module.exports = inject