mojang-lib
A modern wrapper for interacting with the Mojang API.
This library is a rewritten version of minecraft-lib in Typescript.
The list of changes made are available here.
Install
PNPM - pnpm add mojang-lib
(Recommended)
NPM - npm i mojang-lib
Yarn - yarn add mojang-lib
Usage
ESM
import { players, servers } from "mojang-lib"
const server = await servers.get('play.earthmc.net')
console.log(server)
const player = await players.get('Owen3H')
console.log(player)
CommonJS
const MCAPI = require("mojang-lib")
async function runTest() {
const server = await MCAPI.servers.get('play.earthmc.net')
console.log(server)
const player = await MCAPI.players.get('Owen3H')
console.log(player)
}
runTest()