Minecraft Java Edition has /data command, but Bedrock Edition doesn't have it so we can't modify NBT of items/entities on Bedrock Edition right now.
Syntax: (TypeScript)
ItemStack.getNBT() :NbtTag
Entity.getNBT() :NbtTag
//defines types of NBT tag
enum NbtTagType{
compound="compound",
list="list",
str="string",
byte="byte",
short="short",
int="int",
//JavaScript's number type cannot represent this type accurately, so we have to use BigInt instead
long="long",
float="float",
double="double",
//aliases
int8="byte",
int16="short",
int32="int",
int64="long",
float32="float",
float64="double"
}
//NbtTag class contains informations of NBT tag
//It can contain any type of tag that is in NbtTagType enum
read-only NbtTag.type :NbtTagType
//creates NbtTag object
//type of value must match to tagType argument
//throws error if tag type cannot represent specified value
new NbtTag(tagType :NbtTagType, value :Record<string,NbtTag>|NbtTag[]|string|BigInt|number)
//only valid when NbtTag stores compound data
NbtTag.getKey(keyName :string) :NbtTag|undefined
NbtTag.setKey(keyName :string, value :NbtTag) :NbtTag|undefined
NbtTag.hasKey(keyName :string) :boolean
//sets value of itself
NbtTag.setValue(value :NbtTag) :NbtTag
//returns primitive value of itself
NbtTag.getPrimitiveValue() :Record<string,NbtTag>|NbtTag[]|string|BigInt|number
//path argument contains NBT path
//example: Inventory[{Slot:0b}]
NbtTag.getNbtFromPath(path :string) :NbtTag[]
//1500 characters limit reached
Please sign in to leave a comment.
0 Comments