Usage and constraints

Expose a finite storage block that persists resources and Nebula recovery metadata together. Replacing the block must change its identity. Read and simulation operations cannot mutate state. An arbitrary capability that only simulates insertion is not a transaction guarantee.

  1. DiscoverRead capabilities and recipes
  2. PlanReserve exact resources
  3. RunTransfer to the real owner
  4. RecoverRead the saved receipt
Recipe discovery is read-only. Only execution transfers ownership; recovery must not replay a consumed input.

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
}
Source

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

43b4d12d69e6033c24fa8c39dac383ef2429b446