Coder Social home page Coder Social logo

krisrosengreen / mineflayer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prismarinejs/mineflayer

0.0 0.0 0.0 10.74 MB

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

Home Page: https://mineflayer.prismarine.js.org

License: MIT License

JavaScript 100.00%

mineflayer's Introduction

Mineflayer

NPM version Build Status Discord Gitter Irc

Try it on gitpod

US English RU Russian

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

Features

  • Supports Minecraft 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14 and 1.15.
  • 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, dispensers, enchantment tables.
  • Digging and building.
  • Miscellaneous stuff such as knowing your health and whether it is raining.
  • Activating blocks and using items.
  • Chat.

Roadmap

Usage

Without version specified, the version of the server will be guessed automatically, you can set a specific one using the version option. For example version:"1.8".

Echo Example

var mineflayer = require('mineflayer');
var bot = mineflayer.createBot({
  host: "localhost", // optional
  port: 25565,       // optional
  username: "[email protected]", // email and password are required only for
  password: "12345678",          // online-mode=true servers
  version: false                 // false corresponds to auto version detection (that's the default), put for example "1.8.8" if you need a specific version
});
bot.on('chat', function(username, message) {
  if (username === bot.username) return;
  bot.chat(message);
});
bot.on('error', err => console.log(err))

Debug

You can enable some protocol debugging output using DEBUG environment variable:

DEBUG="minecraft-protocol" node [...]

On windows :

set DEBUG=minecraft-protocol
node your_script.js

More Examples

Third Party Plugins

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

The most updated and useful are :

But also check out :

  • navigate - get around easily using A* pathfinding. YouTube Demo
  • radar - web based radar interface using canvas and socket.io. YouTube Demo
  • blockfinder - find blocks in the 3D world
  • scaffold - get to a target destination even if you have to build or break blocks to do so. YouTube Demo
  • auto-auth - chat-based bot authentication
  • Bloodhound - determine who and what is responsible for damage to another entity
  • tps - get the current tps (processed tps)

Projects Using Mineflayer

Installation

npm install mineflayer

Documentation

Contribute

Please read https://github.com/PrismarineJS/prismarine-contribute

Testing

Some setup is required after first cloning the project but after that is done it's very easy to run them.

Setup

In order to get all tests to run successfully you must first:

  1. create a new folder in which to store minecraft server jars
  2. set the MC_SERVER_JAR_DIR to this folder

Example:

  1. mkdir server_jars
  2. export MC_SERVER_JAR_DIR=/full/path/to/server_jars

Where the "/full/path/to/" is the fully qualified path name.

Testing everything

Simply run: npm test

Testing specific version

Run npm test -g <version>, where <version> is a minecraft version like 1.12, 1.15.2...

Testing specific test

Run npm test -g <test_name>, where <test_name> is a name of the test like bed, useChests, rayTrace...

Updating to a newer protocol version

  1. Wait for a new version of node-minecraft-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.

Licence

MIT

mineflayer's People

Contributors

rom1504 avatar andrewrk avatar thejoshwolfe avatar darthfett avatar wvffle avatar karang avatar plexigras avatar pietro210 avatar roblabla avatar deathcap avatar hexatester avatar zuazo avatar nevercast avatar vogonistic avatar greenkeeper[bot] avatar greenkeeperio-bot avatar idanho avatar imharvol avatar corgano avatar thedudefromci avatar shketov avatar jakibaki avatar crazy2be avatar krisrosengreen avatar g07cha avatar superop535 avatar kupferhirn avatar pratham2003 avatar mrzillagold avatar gjum avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.