mineflayer plugin which gives bots a function to find the nearest block
A library to help your mineflayer bot find blocks in the 3D world.
var mineflayer = require'mineflayer';var blockFinderPlugin = require'mineflayer-blockfinder'mineflayer;var bot = mineflayercreateBotusername: 'Player';// Install the pluginblockFinderPluginbot;// Sample usagebotonce'spawn'botfindBlockpoint: botentitypositionmatching: 56maxDistance: 256count: 1if errreturn botchat'Error trying to find Diamond Ore: ' + err;botquit'quitting';return;if blockPointslengthbotchat'I found a Diamond Ore block at ' + blockPoints0 + '.';botquit'quitting';return;elsebotchat"I couldn't find any Diamond Ore blocks within 256.";botquit'quitting';return;;;
Finds the nearest block(s) to the given point.
options- Additional options for the search:
point- The start position of the search.
matching- A function that returns true if the given block is a match. Also supports this value being a block id or array of block ids.
maxDistance- The furthest distance for the search, defaults to 64.
count- The number of blocks to find at most, defaults to 1.
callback- A callback function to get the result. Function signature:
Finds the nearest block(s) to the given point synchronously.
- Added new OctahedronIterator class, a fast finder algorithm that always returns the closest block, and is comparable with the cube algorithm.
- Reverted algorithm to use the old, fast cube algorithm.
- Fix 'matching' option to allow for array of ids instead of crashing.
- Refactored algorithm to use an Iterator approach, to allow for re-useable code.
- Rewrote block finding algorithm to guarantee the closest block is always found first.
- Matching argument now takes an array of block ids, instead of block enums.