minecraft-server

Banner Image

NPM downloads Github contributors Open in vscode

Github NPM Docs

⚠ WARNING: This package is not finished and does not cover the full Minecraft protocol yet. It only covers parts of the 1.16.3 protocol. To check what parts of the protocol are covered, see the docs. New package updates will change the API and add more coverage.

Create Minecraft Servers with an easy to use API and with full control

This is a library that gives you access to an easy to use API that you can use to create Minecraft Java Edition servers. This package includes types so that your IDE has autocomplete. You have full control over the protocol and everything that is being sent to the client in an easy way. This means you have full control of what is being sent to each Client, and that you can send different information to different Clients.

Installation and usage

  1. Install with npm i @boem312/minecraft-server.
  2. Now you can use the library. Here's an example code:
const { Server } = require('@boem312/minecraft-server');
const server = new Server();

server.on('connect', client => {

console.log(`${client.username} joined`);
client.chat(`Hello world, ${client.username}`);

});
  1. Join the server with Minecraft Java Edition version 1.16.3 on host localhost and on port 25565. Different versions and ports are currently not supported.

If you want to now how to use the rest of the library, please see the documentation.

For more examples, please see the examples folder.

If you have any questions please first read the FAQ. If your question isn't in there, you can ask a question in discussions.

Goals

Not all goals are fully finished.

  • Full protocol coverage, every packet is implemented in the library with an easy to use API.
  • Everything is per Client, meaning you can, for example, have different server lists, or different worlds based on the Client.
  • Easy to use, you can create servers in an intuitive way.

Terms

Client

A client is a person that is (going to be) connected to the server.

Player

A player is just a type of entity. It is the thing that a client sees, when they see other people. Each client has it's own players. Here's an example:

In this case, there are two Clients online; Notch and jeb_ and they both see eachother. A player doesn't have to be a client, it could also be a NPC. Here's an example of that:

  • Notch (Client)
    • jeb_ (Player)
    • Hub (Player)
  • jeb_ (Client)
    • Hub (Player)

Here Notch sees jeb_, but jeb_ doesn't see Notch. Both jeb_ and Notch see the NPC Hub. Hub isn't a Client that is connected to the server, but is seen by Notch and jeb_ as a player.

NPC

Non player character, a player who appears as a real human, but is just virtual and isn't connected to the server.

Entity

Entities include all dynamic, moving objects throughout the Minecraft world. Some examples of entities are:

  • Pigs
  • Armor stands
  • Minecarts
  • Players
  • Falling blocks

Contributing

See contributing.md

License

For the full license, see license.md. This package uses the ISC license.

ISC License explanation
ISC License explanation

Special thanks