Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

mcstructure-js

HTMonkeyG315MIT1.2.1

A NodeJS package for .mcstructure read & write

mcbe, mcpe, structure, file, nbt, format

readme

MCStructure.js

Icon

A NodeJS package under Upper Narrator Unified Toolpack project. The package provides API to read and write .mcstructure files generated by MCBE. It also can be used in saved structures in MCBE archive db.

This package is avaliable on browser.

Install

npm i mcstructure-js

Usage

Read:

const MCS = require("mcstructure-js")
    , fs = require("fs");

var st = MCS.deserialize(fs.readFileSync("./chests.mcstructre"));

console.log(st.getBlock({x: 0, y: 0, z: 0}));

Write:

const MCS = require("mcstructure-js")
    , PMR = require("project-mirror-registry")
    , fs = require("fs");

var st = new MCS(5, 5, 5)
  , bl = PMR.createUniversalTag("block")
  , be = PMR.createBlockEntity("commandBlock");

bl.name = "minecraft:command_block";
be.Command = "say Hello Minecraft!";

st.setBlock({x: 2, y: 2, z: 2}, bl);
st.setBlockData({x: 2, y: 2, z: 2}, be);

API Document

See API.md.

Relative Repositories

  • Project-Mirror-Registry - A NodeJS package produces template data of MCBE NBT.
  • Narrator.js - A NodeJS package provides API to operate MCBE archive data directly.
  • ParseNBT.js - A NodeJS package for reading and writing NBTs like vanilla JS objects.