Skip to content

[Question] How can I get/write a list of some types? #268

@ChenCMD

Description

@ChenCMD

I want to retrieve or write a list of types whose elements are part of the NBTCompound type for general-purpose NBT operations, but I am stuck because I do not know how to retrieve some list types (Byte/Short/ByteArray/IntArray/LongArray/nested list) and how to set the list I am stuck because I don't know how to get some list types (Byte/Short/ByteArray/IntArray/LongArray/nested list) and how to set list types.
What should I do?

For example, the NBTCompound types getInteger and getIntegerList exist, but getShortList does not exist even though getShort does.

Just to be sure, here are the SNBT expressions for each and what is missing.

Name SNBT representation get method available set method available
StringList ["", "", ""] o x
ByteList [0b, 1b, 2b] x x
ShortList [0s, 1s, 2s] x x
IntegerList [0, 1, 2, 3] o x
LongList [0L, 1L, 2L] o x
FloatList [0f, 1f, 2f] o x
DoubleList [0d, 1d, 2d] o x
ByteArrayList [[B; 0b, 1b, 2b], [B; 3b, 4b, 5b]] x x
IntArrayList [[I; 0, 1, 2, 3], [I; 4, 5, 6, 7]] x x
LongArrayList [[L; 0L, 1L, 2L], [L; 3L, 4L, 5L]] x x
CompoundList [{a: 1, b: 2, c: 3}, {x: 4, y: 5}] o △ (If the key is present then getCompoundList(key).addCompound())
NestedList [[0b, 1b], [2s, 3s], [4, 5], [6L]] x x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions