Usage and constraints
Declare the API version your extension needs. API 1.0.0 is separate from the mod release and network protocol versions. A compatible major version is required, with at least the requested minor and patch level.
NebulaApiVersion
package dev.nebulastorage.api
/** API version, independent of the mod's release and wire protocol. Compatibility requires the same major and a sufficient minor/patch. */
data class NebulaApiVersion(val major: Int, val minor: Int, val patch: Int) : Comparable<NebulaApiVersion> {
init { require(major > 0 && minor >= 0 && patch >= 0) }
override fun compareTo(other: NebulaApiVersion): Int = compareValuesBy(this, other, { it.major }, { it.minor }, { it.patch })
fun supports(required: NebulaApiVersion): Boolean = major == required.major && this >= required
override fun toString(): String = "$major.$minor.$patch"
companion object {
@JvmField val CURRENT = NebulaApiVersion(1, 0, 0)
}
}
/** Optional minimum API declaration checked before registration. Existing unversioned extensions remain supported. */
interface NebulaVersionedExtension : NebulaExtension {
val requiredApiVersion: NebulaApiVersion
}
Source
src/main/kotlin/dev/nebulastorage/api/NebulaApiVersion.kt; editorial/en.json
43b4d12d69e6033c24fa8c39dac383ef2429b446