Skip to content

ArchieStorageList

class ArchieStorageList<T : UpdateManager<NbtTag>> : Iterable<T> 

A dynamically-sized, index-ordered list of storage-like UpdateManagers, declared via NBTHolder.itemListField/fluidListField/energyListField. Every entry shares the same shape (size/limit/capacity), built via factory on add.

Persisted as an NbtCompound keyed by stringified index, not a genuine NBT list - a raw NBT ListTag requires every element be the same concrete tag type, which knbt only exposes a public builder API for when that type is statically known. T's snapshot shape is uniform at runtime (every entry is the same concrete storage type) but erased to plain NbtTag at compile time, so it can't use that API; a compound sidesteps the restriction entirely; ordering is still preserved by parsing/reassigning indices on save.

Properties

size

val size: Int

Functions

add

fun add(): T

Builds a new entry via factory, appends it, marks this dirty, and returns it.

clear

fun clear()

get

operator fun get(index: Int): T

iterator

open operator override fun iterator(): Iterator<T>

removeAt

fun removeAt(index: Int): T

Removes and returns the entry at index, marking this dirty.