Create Minecraft bots with a powerful, stable, and high level JavaScript API.
JavaScript
Pull request Compare This branch is 474 commits behind PrismarineJS:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
doc
examples
lib
test
.gitignore
.jshintrc
.npmignore
README.md
index.js
package.json

README.md

Mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.

Features

  • Supports Minecraft 1.4.7.
  • Entity knowledge and tracking.
  • Block knowledge. You can query the world around you.
  • Basic physics and movement - currently blocks are either "solid" or "empty".
  • Attacking entities and using vehicles.
  • Inventory management.
  • Crafting, chests, and dispensers.
  • Digging and building.
  • Miscellaneous stuff such as knowing your health and whether it is raining.
  • Activating blocks and using items.
  • Chat.

Roadmap

  • Brewing stands, anvils, and enchanting tables.
  • Better physics (support doors, ladders, water, etc).

Usage

Echo Example

var mineflayer = require('mineflayer');
var bot = mineflayer.createBot({
  host: "localhost", // optional
  port: 25565,       // optional
  username: "email@example.com", // email and password are required only for
  password: "12345678",          // online-mode=true servers
});
bot.on('chat', function(username, message) {
  if (username === bot.username) return;
  bot.chat(message);
});

More Examples

Third Party Plugins

Mineflayer is pluggable; anyone can create a plugin that adds an even higher level API on top of Mineflayer.

Projects Using Mineflayer

Installation

Linux / OSX

npm install mineflayer

Windows

  1. Follow the Windows instructions from node-minecraft-protocol
  2. npm install mineflayer

Documentation

Testing

npm test

Updating to a newer protocol version

  1. Wait for a new version of mineflayer-protocol to be released which supports the new Minecraft version.
  2. npm install --save minecraft-protocol@latest
  3. Apply the protocol changes where necessary.
  4. Run the test suite. See Testing above.