NBTElementHelper.NBTCompoundHelper
com.jsmacrosce.jsmacros.client.api.helper.NBTElementHelper.NBTCompoundHelper
Wraps a compound tag and provides access to its keys and values.
js
const player = Player.getPlayer();
if (player !== null) {
const nbt = player.getMainHand().getNBT();
if (nbt instanceof NBTHelpers.Compound) {
Chat.log(nbt.getKeys());
}
}Available in scripts as NBTHelpers.Compound.
Nested type declared in NBTElementHelper.
Constructors
new NBTElementHelper.NBTCompoundHelper
new NBTElementHelper.NBTCompoundHelper(CompoundTag base)#Wraps the supplied compound tag without copying it.
Parameters:
base: the compound tag to wrap
Methods
asString
Returns the string value under
key, or its textual representation for non-string tags.Parameters:
key: the key to retrieve
Returns: the value's string or textual representation, or
null if absentget
Returns the value under
key, or null if absent.Parameters:
key: the key to retrieve
Returns: the value, or
null if absentgetKeys
getType
Returns the tag type id for the value under
key, or -1 if absent.Parameters:
key: the key to check
Returns: the value's tag type id, or
-1 if absentReturns this tag's Minecraft NBT type id; see the class documentation for the mapping.
Returns: this tag's NBT type id