|
|
|
@ -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 } |