Verwendung und Grenzen

Zeigt eine abgetrennte Ausrüstungsansicht und sichere Einstellungen. Änderungen dürfen keine Ressourcen bewegen, Upgrades oder Energie verändern oder Sicherheitsprüfungen umgehen.

NebulaMachineConfiguration

NebulaMachineConfiguration
package dev.nebulastorage.api.platform

import net.minecraft.network.chat.Component
import net.minecraft.world.item.ItemStack
import java.util.Collections

/** Detached display of upgrades owned by the physical machine; no installation or resource mutation is authorized by this view. */
interface NebulaMachineEquipmentView { fun equipment(): List<NebulaMachineEquipment> }
class NebulaMachineEquipment(item: ItemStack, val installed: Int, val limit: Int) {
    private val prototype = item.copy()
    val item: ItemStack get() = prototype.copy()
    init { require(!item.isEmpty && limit in 1..64 && installed in 0..limit) }
}

/** Bounded local setting. IDs and values are stable protocol identities, labels are translatable display data. */
class NebulaMachineSetting(val id: String, label: Component, values: List<NebulaMachineSettingValue>, val selected: String, val editable: Boolean = true) {
    private val title = label.copy()
    val label get() = title.copy()
    val values: List<NebulaMachineSettingValue> = Collections.unmodifiableList(values.toList())
    init {
        require(id.matches(Regex("[a-z0-9_.:-]{1,64}")) && values.size in 1..16)
        require(values.map { it.id }.distinct().size == values.size && values.any { it.id == selected })
    }
}
class NebulaMachineSettingValue(val id: String, label: Component) {
    private val title = label.copy()
    val label get() = title.copy()
    init { require(id.matches(Regex("[a-z0-9_.:-]{1,64}"))) }
}

/**
 * Settings belong to the certified physical owner and share its chunk persistence.
 * Queries are read-only; applying an advertised value must not change resources, energy, upgrades, security or ownership.
 * Nebula revalidates loaded ownership and refuses changes while any operation owns a lane.
 */
interface NebulaMachineConfiguration {
    fun settings(): List<NebulaMachineSetting>
    fun configure(id: String, value: String): Boolean
}
Quelle

src/main/kotlin/dev/nebulastorage/api/platform/NebulaMachineConfiguration.kt; editorial/de.json

43b4d12d69e6033c24fa8c39dac383ef2429b446