使い方と制約
内容が全てコンポーネントに保存された単一容器を扱います。充填は実資源を消費します。emptyContainerは取得・製造すべき容器の指定であり、無料配布ではありません。
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
}
ソース
src/main/kotlin/dev/nebulastorage/api/platform/NebulaResourceContainer.kt; editorial/ja.json
43b4d12d69e6033c24fa8c39dac383ef2429b446