mcpc-server
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

mcpc-server

NPM version Build Status Discord Try it on gitpod

Command line program (CLI) and API for starting and working with Minecraft Java Edition servers.

Running & Installation

Start a server through the command line:

npx mcpc-server -v 1.18

Or with npm to use programmatically:

npm install mcpc-server

Usage

via command line

npx mcpc-server --help
npx mcpc-server --version 1.18 --online --path ./my1.18server

any extraneous -- options will be placed inside the server.properties file, e.g. --level-name coolWorld.

via code

see index.d.ts

const mcpcServer = require('mcpc-server')

const onStart = () => console.log('Server started!')

mcpcServer.startServer('1.18.0', onStart, { 'server-port': 25565, 'online-mode': true, path: './bds' })

Get latest server data

From minecraft.net downloads

mcpcServer.getLatestVersions().then(console.log)

to get

[
  [ '1.21.4', 'release', '2024-12-03T10:24:48+00:00' ],
  [ '1.21.4-pre1', 'snapshot', '2024-12-03T10:00:03+00:00' ],
  [ '24w46a', 'snapshot', '2024-12-03T10:00:03+00:00' ],
  ...
  [ '1.21.2', 'release', '2024-12-03T06:33:45+00:00' ],
  [ '24w40a', 'snapshot', '2024-12-03T06:33:45+00:00' ]
]

Help screen

mcpc-server - v1.0.0
Minecraft Java Edition Server runner
Usage:
  mcpc-server --version latest      Start a server on the latest version
  mcpc-server --versions            List all avaliable versions
  mcpc-server -v 1.20 --download    Download v1.20

Options:
  --version, -v Version to download (use "latest" for latest)  
  --port        Port to listen on for IPv4  (default: 25565)
  --online      Whether to run in online mode  
  --path        Custom path to the server directory  
  --versions    Passing --versions will list all versions  
  --dumpRegistries      Run all data generators and output to the passed path  
  --download    Download (but not run) the server binary 

API

See the exported TypeScript defs for method docs.

Testing

npm test

History

See history

Readme

Keywords

Package Sidebar

Install

npm i mcpc-server

Weekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

22.2 kB

Total Files

16

Last publish

Collaborators

  • extremeheat