使い方と制約
Minecraft依存アダプターをドメイン契約と分けて登録します。読み込み済みチャンク内の有限な所有者が必要で、遠隔プロキシやクリエイティブ供給元を自動的に復旧可能とは見なしません。
- 検出能力とレシピを読む
- 計画正確な資源を予約する
- 実行実際の所有者へ転送する
- 復旧保存された受領記録を読む
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?
}
ソース
src/main/kotlin/dev/nebulastorage/api/platform/NebulaPlatformExtension.kt; editorial/ja.json
43b4d12d69e6033c24fa8c39dac383ef2429b446