使い方と制約
資源とNebula復旧情報を一緒に保存する有限ストレージです。ブロック交換時はIDを変えます。読み取り・試行は無変更で、Capabilityの試行だけを取引保証にしません。
- 検出能力とレシピを読む
- 計画正確な資源を予約する
- 実行実際の所有者へ転送する
- 復旧保存された受領記録を読む
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