Verwendung und Grenzen
Stellt einen begrenzten Speicher bereit, der Ressourcen und Wiederherstellungsdaten gemeinsam sichert. Blockersatz ändert seine Identität. Lesen und Simulieren bleiben ohne Mutation; Capability-Simulation allein garantiert keine Transaktion.
- EntdeckenFähigkeiten und Rezepte lesen
- PlanenExakte Ressourcen reservieren
- AusführenAn realen Besitzer übertragen
- FortsetzenGespeicherten Beleg lesen
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
}
Quelle
src/main/kotlin/dev/nebulastorage/api/platform/NebulaResourceStorage.kt; editorial/de.json
43b4d12d69e6033c24fa8c39dac383ef2429b446