A datapack that can identify the type of NBT data from user input.
Possible types that can be identified are:
ByteShortIntLongFloatDoubleListStringCompoundByte ArrayInt ArrayLong Array
See also: Minecraft NBT TAG definitions
- Namespace:
typeid - Scorespace:
typeid - Incompatibilities:
none
- Use the
typeid:argsstorage to input the data that you want to identify the type of. Input the data usingdata modify storage typeid:args Data set .... - Call the function
typeid:get_typeusingfunction type_id:get_type. - The results of the function will be stored in the
typeid:resultstorage (for more info, see Function output below). The ID of the type is stored in theTypeIDfield and a stringified version of the ID is stored in theTypeStrfield. The ID of the identified type is also stored in the#typeid.type_id typeid.varfakeplayer score.
The type IDs correspond to the TAG definitions on the wiki. Below is a table of the TypeIDs and their corresponding TypeStr used in this datapack.
| TypeID | TypeStr |
|---|---|
| 1 | Byte |
| 2 | Short |
| 3 | Int |
| 4 | Long |
| 5 | Float |
| 6 | Double |
| 7 | Byte Array |
| 8 | String |
| 9 | List |
| 10 | Compound |
| 11 | Int Array |
| 12 | Long Array |