Appearance
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]}| Helper | SNBT |
|---|---|
| plain number | 1 (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
- Entity data
- Selectors:
.nbt(...)