refactor: ♻️ use array in pathfinder movements list
This commit is contained in:
parent
f4445749e6
commit
fb066ee8a5
|
@ -16,12 +16,18 @@ let movements = []
|
||||||
|
|
||||||
|
|
||||||
function initMoves(bot = bot, mcData = require('minecraft-data')(bot.version)) {
|
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)
|
let defaultMove = new Movements(bot, mcData)
|
||||||
defaultMove.canDig = false
|
defaultMove.canDig = false
|
||||||
defaultMove.scafoldingBlocks.push(mcData.blocksByName.slime_block.id)
|
defaultMove.scafoldingBlocks.push(mcData.blocksByName.slime_block.id)
|
||||||
// defaultMove.blocksCantBreak.add(mcData.blocksByName.glass.id)
|
// defaultMove.blocksCantBreak.add(mcData.blocksByName.glass.id)
|
||||||
// defaultMove.blocksToAvoid.add(mcData.blocksByName.magma.id)
|
// defaultMove.blocksToAvoid.add(mcData.blocksByName.magma.id)
|
||||||
movements.defaultMove = defaultMove
|
movements.push(defaultMove)
|
||||||
|
movements.defaultMove = movements[0]
|
||||||
|
|
||||||
bot.pathfinder.setMovements(defaultMove)
|
bot.pathfinder.setMovements(defaultMove)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user