Usage and constraints

Adapt one detached container item whose complete contents live in its components. Filling must consume real network resources. emptyContainer identifies an item to obtain or craft; it never grants a free bucket or tank.

NebulaResourceContainer

NebulaResourceContainer
package dev.nebulastorage.api.platform

import dev.nebulastorage.api.resource.ResourceKey
import dev.nebulastorage.api.resource.ResourceStack
import dev.nebulastorage.api.resource.ResourceTypeId
import net.minecraft.world.item.ItemStack

/** Resolve only finite item-owned storage. Nebula supplies a detached, single-item copy; no world or external owner may be accessed. */
fun interface NebulaResourceContainerAdapter {
    fun resolve(container: ItemStack): NebulaResourceContainer?

    /** A fresh empty, finite container for this identity, or EMPTY. The caller must acquire or craft the real item before filling it. */
    fun emptyContainer(resource: ResourceKey): ItemStack = ItemStack.EMPTY
}

/** All state must live in [container]'s components. Simulations are read-only and transfers affect only the exact requested identity. */
interface NebulaResourceContainer {
    val container: ItemStack
    val resourceType: ResourceTypeId
    fun contents(): Map<ResourceKey, Long>
    fun insert(request: ResourceStack, simulate: Boolean): Long
    fun extract(request: ResourceStack, simulate: Boolean): Long
}
Source

src/main/kotlin/dev/nebulastorage/api/platform/NebulaResourceContainer.kt; editorial/en.json

43b4d12d69e6033c24fa8c39dac383ef2429b446