feat(mover): ✨ implement moveY (vertical move up or down)
Doesn't appear to be working properly, bot assumes XZ is goal reached
This commit is contained in:
parent
8a39596b1d
commit
7b2b936f81
|
@ -209,6 +209,10 @@ function command(username, message) {
|
|||
case "closer":
|
||||
subcommand("go follow close")
|
||||
break
|
||||
case "up":
|
||||
case "down":
|
||||
cfg.plugins.mover.moveY(player.position)
|
||||
break
|
||||
default:
|
||||
subcommand("go follow once")
|
||||
}
|
||||
|
|
|
@ -50,6 +50,19 @@ function moveXZ(pos) {
|
|||
bot.pathfinder.setGoal(new GoalXZ(pos.x, pos.z))
|
||||
}
|
||||
|
||||
function moveY(pos) {
|
||||
const { GoalY } = require('mineflayer-pathfinder').goals
|
||||
|
||||
if (Array.isArray(pos) && pos.length == 1) {
|
||||
pos = v(null, pos[0], null)
|
||||
}
|
||||
pos = v(pos)
|
||||
console.log(pos)
|
||||
cfg.quiet || bot.chat(`moving to ${pos.floored()}`)
|
||||
bot.pathfinder.setMovements(movements.defaultMove)
|
||||
bot.pathfinder.setGoal(new GoalY(pos.y))
|
||||
}
|
||||
|
||||
function follow(entity, dynamic = true, distance = 3) {
|
||||
console.assert(entity)
|
||||
const { GoalFollow } = require('mineflayer-pathfinder').goals
|
||||
|
@ -120,4 +133,4 @@ const unload = () => {
|
|||
bot.off('goal_reached', goalReached)
|
||||
}
|
||||
|
||||
module.exports = { load, unload, stop, initMoves, moveNear, moveXZ, follow }
|
||||
module.exports = { load, unload, stop, initMoves, moveNear, moveXZ, moveY, follow }
|
Loading…
Reference in New Issue
Block a user