NBTHelpers
Lets scripts distinguish numbers, lists, and compounds in NBT data through the NBTHelpers global.List includes array-tag helpers; string tags have no separate helper class.
js
const player = Player.getPlayer();
if (player !== null) {
const tag = player.getNBT();
if (tag instanceof NBTHelpers.Compound) {
Chat.log(tag.getKeys());
}
}These names are available in JavaScript and Python without importing anything. They are read-only aliases of Java types, so instanceof works as usual.
| Script name | What it is |
|---|---|
NBTHelpers.Compound | Wraps a compound tag and provides access to its keys and values. |
NBTHelpers.Element | Wraps an NBT tag and provides type checks, typed helper views, and path lookup. |
NBTHelpers.List | Provides indexed access to list and array tags, and converts four-int arrays to UUIDs. |
NBTHelpers.Number | Wraps a numeric tag and provides conversions to primitive numeric types. |