refactor: ♻️ use array in pathfinder movements list
This commit is contained in:
		| @@ -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) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user