N B T-REX 🦖

Named Binary Tyrannosaurus Rex

(nbt-ts modified for Deno)


Usage

Encoding a .mcstructure file:

import { encode, Int } from "https://deno.land/x/nbtrex/mod.ts";
const structure = encode("root", {
    format_version: new Int(1),
    size: [new Int(1), new Int(1), new Int(1)],
    structure_world_origin: [new Int(0), new Int(0), new Int(0)],
    structure: {
      block_indices: [[new Int(0), new Int(0), new Int(0)], [
        new Int(-1),
        new Int(-1),
        new Int(-1),
      ]],
      entities: [],
      palette: {
        default: {
          block_palette: [] as Array<{ version: Int; name: string }>,
          block_position_data: {},
        },
      },
    },
  }