refactor: ♻️ use array in pathfinder movements list

This commit is contained in:
jay 2020-12-24 11:26:19 +05:00
parent f4445749e6
commit fb066ee8a5

View File

@ -16,12 +16,18 @@ let movements = []
function initMoves(bot = bot, mcData = require('minecraft-data')(bot.version)) {
console.info(movements)
if (movements.length > 0) {
bot.pathfinder.setMovements(defaultMove)
return console.warn("movements already initialized!")
}
let defaultMove = new Movements(bot, mcData)
defaultMove.canDig = false
defaultMove.scafoldingBlocks.push(mcData.blocksByName.slime_block.id)
// defaultMove.blocksCantBreak.add(mcData.blocksByName.glass.id)
// defaultMove.blocksToAvoid.add(mcData.blocksByName.magma.id)
movements.defaultMove = defaultMove
movements.push(defaultMove)
movements.defaultMove = movements[0]
bot.pathfinder.setMovements(defaultMove)
}