Alpha: this compiler is under active development and updates will break your projects. Not recommended for real use yet.
Skip to content

NBT ​

Nbt(obj) turns a JS object into SNBT.

ts
Nbt({ NoGravity: Byte(1), Pos: [Double(0.5), Double(64), Double(0.5)] });
// {NoGravity:1b,Pos:[0.5d,64.0d,0.5d]}
HelperSNBT
plain number1 (int)
Float(n)1.0f
Double(n)1.0d
Byte(n)1b
Short(n) / Long(n)1s / 1l

Value objects like Block or Item inside the tree render for the target version.

TIP

For entities and block entities, use the typed entity data factories instead. Raw Nbt there warns at build time.

See also ​

Released under the MIT License · Credits
These docs were written with AI; the layout and every page have been reviewed by a human.