parse

fun parse(nbt: Any, options: NativeObject? = null): NBTBase

Creates a new NBTBase from the given nbt

Return

NBTTagCompound if nbt is an object, NBTTagList if nbt is an array and preferArraysOverLists is false, or NBTBase otherwise.

Parameters

nbt

the value to convert to NBT

options

optional argument to allow refinement of the NBT data. Possible options include:

  • coerceNumericStrings: Boolean, default false. E.g. "10b" as a byte, "20s" as a short, "30f" as a float, "40d" as a double, "50l" as a long

  • preferArraysOverLists: Boolean, default false E.g. a list with all bytes or integers will be converted to an NBTTagByteArray or NBTTagIntArray accordingly

Throws

net.minecraft.nbt.NBTException

if nbt can not be parsed as valid NBT

Sources

Link copied to clipboard