Utilisation et contraintes

Enregistrez les adaptateurs Minecraft séparément des contrats de domaine. Un adaptateur physique doit identifier un propriétaire fini dans un chunk chargé. Un proxy distant ou une source créative ne devient pas automatiquement un stockage récupérable.

  1. DécouvrirLire capacités et recettes
  2. PlanifierRéserver les ressources exactes
  3. ExécuterTransférer au vrai propriétaire
  4. ReprendreLire le reçu sauvegardé
La découverte ne modifie rien. Seule l’exécution transfère la propriété ; la reprise ne recrée jamais une entrée consommée.

NebulaPlatformExtension

NebulaPlatformExtension
package dev.nebulastorage.api.platform

import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
import net.minecraft.server.level.ServerLevel
import net.neoforged.neoforge.fluids.capability.IFluidHandler

/** Implement alongside NebulaExtension to register adapters requiring actual Minecraft owners. */
interface NebulaPlatformExtension {
    fun registerPlatform(registrar: NebulaPlatformRegistrar)
}

interface NebulaPlatformRegistrar {
    fun creatureCaptureRule(id: String, rule: NebulaCreatureCaptureRule) {
        throw UnsupportedOperationException("This Nebula runtime does not support creature capture rules")
    }
    fun physicalResourceMachineAdapter(id: String, adapter: NebulaPhysicalResourceMachineAdapter) {
        throw UnsupportedOperationException("This Nebula runtime does not support physical resource machines")
    }
    fun resourceContainerAdapter(id: String, adapter: NebulaResourceContainerAdapter) {
        throw UnsupportedOperationException("This Nebula runtime does not support resource containers")
    }
    fun resourceStorageAdapter(id: String, adapter: NebulaResourceStorageAdapter) {
        throw UnsupportedOperationException("This registrar does not support generic resource storage adapters")
    }
    fun fluidStorageAdapter(id: String, adapter: NebulaFluidStorageAdapter)
    fun physicalItemMachineAdapter(id: String, adapter: NebulaPhysicalItemMachineAdapter) {
        throw UnsupportedOperationException("This registrar does not support physical machine adapters")
    }
}

fun interface NebulaFluidStorageAdapter {
    /**
     * Returns a stable capability instance or null for unsupported owners. Called on the server thread, without forcing chunks.
     * Every accepted handler must mutate only the BlockEntity at [position], whose complete resources and Nebula persistent data
     * are saved together in its chunk NBT. Simulation is read-only; execution returns actual conserved quantities and components.
     * Creative/infinite stores, redirection to another owner, or persistence outside that NBT require another recovery protocol.
     * Revalidate this contract on every call, including configuration, upgrades, ownership and capability replacement.
     */
    fun resolve(level: ServerLevel, position: BlockPos, side: Direction): IFluidHandler?
}
Source

src/main/kotlin/dev/nebulastorage/api/platform/NebulaPlatformExtension.kt; editorial/fr.json

43b4d12d69e6033c24fa8c39dac383ef2429b446