Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Latest commit

 

History

History
26 lines (19 loc) · 1008 Bytes

README.md

File metadata and controls

26 lines (19 loc) · 1008 Bytes

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