ArchieItemStorage¶
@Serializable
(with = ArchieItemStorage.Serializer::class)open class ArchieItemStorage : CommonStorage<ItemResource> , UpdateManager<NbtTag>
Archie's platform-agnostic item container: a fixed-size list of ArchieItemSlots that implements Common Storage Lib's CommonStorage (resource-based insert/extract for capability interop) and Archie's NBT serialization (via Serializer) for save/load.
Usually created through net.kernelpanicsoft.archie.serialization.NBTHolder.itemField rather than directly. Its public surface is deliberately small; read or mutate the net.minecraft.world.item.ItemStack in a slot through the ArchieItemSlot returned by get, not on the storage itself.
Parameters¶
- onUpdate: Invoked by
updatewhenever the storage's contents should be persisted/synced.
Constructors¶
ArchieItemStorage¶
Creates a storage with size empty slots.
Types¶
Serializer¶
object Serializer : KSerializer<ArchieItemStorage>
Serializes an ArchieItemStorage as the plain list of its ArchieItemSlots.
Functions¶
allowsExtraction¶
open fun allowsExtraction(): Boolean
allowsInsertion¶
open fun allowsInsertion(): Boolean
createSnapshot¶
open override fun createSnapshot(): NbtTag
extract¶
get¶
open operator override fun get(slot: Int): ArchieItemSlot
The ArchieItemSlot at slot, for reading/mutating its net.minecraft.world.item.ItemStack.
getAmount¶
getContents¶
open fun getContents(index: Int): ResourceStack<ItemResource?>?
getLimit¶
getResource¶
open fun getResource(index: Int): ItemResource?
insert¶
isResourceValid¶
open fun isResourceValid(index: Int, resource: ItemResource?): Boolean
readSnapshot¶
open override fun readSnapshot(snapshot: NbtTag)
size¶
The number of slots in this storage.
update¶
open override fun update()