NBTElementHelper.NBTListHelper
com.jsmacrosce.jsmacros.client.api.helper.NBTElementHelper.NBTListHelper
Provides indexed access to list and array tags, and converts four-int arrays to UUIDs.
js
const player = Player.getPlayer();
if (player !== null) {
const nbt = player.getMainHand().getNBT();
if (nbt instanceof NBTHelpers.List) {
Chat.log(`${nbt.length()} entries, held type ${nbt.getHeldType()}`);
}
}Available in scripts as NBTHelpers.List.
Nested type declared in NBTElementHelper.
Constructors
new NBTElementHelper.NBTListHelper
new NBTElementHelper.NBTListHelper(CollectionTag base)#Wraps the supplied collection tag without copying it.
Parameters:
base: the collection tag to wrap
Methods
asUUID
get
Returns the element at the zero-based index. An index outside the collection throws IndexOutOfBoundsException.
Parameters:
index: zero-based index
Returns: the element at that index
getHeldType
Returns the component type id for byte, int, and long arrays. For lists, returns
TAG_COMPOUND regardless of their elements.Returns: the array component type id, or
TAG_COMPOUND for a listisPossiblyUUID
length
Returns the number of elements in this list or array.
Returns: the number of elements