Skip to content

Emrio/minecraft-js

Repository files navigation

minecraft-lib npm version license

A pure-JS, promise-based, easy to use library for Minecraft and Mojang API in JavaScript

License | Documentation | Github | Author | Site

Some things you can do with this library :

  • Get player's info
  • Ping a server
  • Get Minecraft services status
  • Manipulate your skin

Installation

In your npm project, simply type :

$ npm install minecraft-lib --save

Basic usage

const MCAPI = require("minecraft-lib")

MCAPI.players.get("Notch")
  .then(player => {
    console.log("Username : " + player.username)
    console.log("UUID : " + player.uuid)
    console.log("Skin URL : " + player.textures.skin_url)
  })
  .catch(console.error)

Docs and examples

The library's methods and attributes are all referenced in the online documentation

Some examples are available here

Dependencies

Minecraft-js loves and uses :

  • minecraft-data: A module from PrismarineJS which provides data about Minecraft in JavaScript
  • request: Best module ever for HTTP requests!
  • js-base64: A base64 transcoder for JavaScript

Related packages

Contributing

Feel free to contribute to the project!

Some attributes are not documented, especially some from MojangAccountProperties because no information have been found. Contributing to the docs would be greatly appreciated!

Please follow the guidelines when contributing!

To do

The following features are not implemented yet:

  • LoggedPlayerTextures.upload_skin()
  • Mojang token manipulation

License

This project is licensed under the MIT License.

Minecraft-js is not affiliated by anyway with Mojang AB. This library is in fact unofficial.