Darthfett / mineflayer-blockfinder

mineflayer plugin which gives bots a function to find the nearest block
19 stars 5 forks source link

mineflayer-blockfinder

A library to help your mineflayer bot find blocks in the 3D world.

See mineflayer.

Usage

var mineflayer = require('mineflayer');
var blockFinderPlugin = require('mineflayer-blockfinder')(mineflayer);
var bot = mineflayer.createBot({username: 'Player'});

// Install the plugin
bot.loadPlugin(blockFinderPlugin);

// Sample usage
bot.once('spawn', function() {
  bot.findBlock({
    point: bot.entity.position,
    matching: 56,
    maxDistance: 256,
    count: 1,
  }, function(err, blocks) {
    if (err) {
      return bot.chat('Error trying to find Diamond Ore: ' + err);
      bot.quit('quitting');
      return;
    }
    if (blocks.length) {
      bot.chat('I found a Diamond Ore block at ' + blocks[0].position + '.');
      bot.quit('quitting');
      return;
    } else {
      bot.chat("I couldn't find any Diamond Ore blocks within 256.");
      bot.quit('quitting');
      return;
    }
  });
});

Dependencies

Installation

npm install mineflayer-blockfinder

Or clone and cd into the directory

npm install .

Windows: You will need to install:

Documentation

bot.findBlock(options, callback)

Finds the nearest block(s) to the given point.

function(err, arrayOfBlocks)

bot.findBlockSync(options)

Finds the nearest block(s) to the given point synchronously.

History

0.0.7

0.0.6

0.0.5

0.0.4

0.0.3

0.0.2