Skip to content

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 nameWhat it is
NBTHelpers.CompoundWraps a compound tag and provides access to its keys and values.
NBTHelpers.ElementWraps an NBT tag and provides type checks, typed helper views, and path lookup.
NBTHelpers.ListProvides indexed access to list and array tags, and converts four-int arrays to UUIDs.
NBTHelpers.NumberWraps a numeric tag and provides conversions to primitive numeric types.