Usage and constraints

Provide a display name, atlas sprite, tint and unit for a resource. Keep these values safe for common-side loading: do not retain a client renderer or a world in this contract. Rendering does not alter resource identity.

NebulaVisualResourceType

NebulaVisualResourceType
package dev.nebulastorage.api.platform

import dev.nebulastorage.api.NebulaResourceType
import dev.nebulastorage.api.resource.ResourceKey
import net.minecraft.network.chat.Component
import net.minecraft.resources.ResourceLocation

/** Common-side display data; no client renderer or mutable world may be retained. The sprite belongs to the block atlas. */
interface NebulaVisualResourceType : NebulaResourceType {
    fun display(key: ResourceKey): NebulaResourceDisplay
}

class NebulaResourceDisplay(name: Component, val sprite: ResourceLocation, val color: Int, val unit: String) {
    private val label = name.copy()
    val name: Component get() = label.copy()
    init { require(unit.length in 1..24) }
}
Source

src/main/kotlin/dev/nebulastorage/api/platform/NebulaVisualResourceType.kt; editorial/en.json

43b4d12d69e6033c24fa8c39dac383ef2429b446