Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.
/ node-mcpi Public archive
forked from choas/minecraft-pi-promise

Node.js API with Promises for Minecraft Raspberry Pi edition

License

Notifications You must be signed in to change notification settings

mdnorman/node-mcpi

 
 

Repository files navigation

mcpi

mcpi allows you to control Minecraft: Raspberry Pi edition server from Node.js. This is intended as a lower-level module, and is meant to be extended on for bigger projects. However, the commands are simple enough to play with as-is.

Usage

const mcpi = require('mcpi');
const mc = new mcpi.Minecraft('localhost', 4711);

// Use the mc variable to play with the server!
mc.chat.post('Yo dawg, I heard you like Node.js, so I put some Node.js in your Pi so you can Node.js while you Pi.');
mc.world.setBlock(3, 14, 15, mcpi.blocks.DiamondBlock);
mc.close();

// Use the returned promises to wait for results
mc.world.getBlock(3, 14, 15)
  .then(block => {
    console.log('blockId:', block.id);
  })
  .then(() => {
    mc.close();
  });

Debug logs

To turn on debug logging, run your program with NODE_DEBUG set to mcpi

About

Node.js API with Promises for Minecraft Raspberry Pi edition

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.8%
  • Shell 0.2%