X

NOTICE

Are you sure you want to report this?

A feedback area designed for scripting and mods suggestions and feedback. Please note bug reports and support issues will be removed.

7

Heterogeneous List Tags

1 Comments

Post a new comment:

Please sign in to leave a comment.

  • 0
    intsuc commented
    Comment actions Permalink
    ■ NBT Layout
    Since each element can have a different type, we need to write its type to each, like compound tags.
        [size: int]([type: byte][element: Tag])*
        (x)* repeats x zero or more times.

    ■ Comparison
    ・List tags
        × heterogeneous
        ✔ indexable (with int)
        ✔ iterable
    ・Heterogeneous list tags
        ✔ heterogeneous
        ✔ indexable (with int)
        ✔ iterable
    ・Compound tags
        ✔ heterogeneous
        ✔ indexable (with string)
        × iterable

    Note that heterogeneous list tags cannot subsume list tags since the latter has a more efficient NBT layout for homogeneous cases.
    For example, the following heterogeneous list tag is 4+(1+2)n bytes,
        [H; 0s, 0s, ...]
    whereas the following list tag is 1+4+2n bytes.
        [0s, 0s, ...]
    where n is the size of the lists.
    In this case, the size of the latter is less than that of the former for all n ≥ 2.