使い方と制約

資源とNebula復旧情報を一緒に保存する有限ストレージです。ブロック交換時はIDを変えます。読み取り・試行は無変更で、Capabilityの試行だけを取引保証にしません。

  1. 検出能力とレシピを読む
  2. 計画正確な資源を予約する
  3. 実行実際の所有者へ転送する
  4. 復旧保存された受領記録を読む
検出は読み取りのみです。所有権は実行時に移り、復旧で消費済み入力を再生成しません。

NebulaResourceStorage

NebulaResourceStorage
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.core.BlockPos
import net.minecraft.core.Direction
import net.minecraft.server.level.ServerLevel
import net.minecraft.world.level.block.entity.BlockEntity

fun interface NebulaResourceStorageAdapter {
    /** Read-only resolution on loaded chunks. A replacement owner or capability must expose a different identity. */
    fun resolve(level: ServerLevel, position: BlockPos, side: Direction): NebulaResourceStorage?
}

/**
 * A finite owner whose complete contents and Nebula transaction metadata share the same chunk NBT.
 * Contents are detached exact quantities. Simulation must not mutate. Transfers return the actual quantity of precisely the requested key.
 * Creative stores, redirection and independent persistence require a different recovery protocol and must not implement this contract.
 */
interface NebulaResourceStorage {
    val entity: BlockEntity
    val identity: Any
    val resourceType: ResourceTypeId
    fun capacity(): Long
    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/NebulaResourceStorage.kt; editorial/ja.json

43b4d12d69e6033c24fa8c39dac383ef2429b446