NovaItem

class NovaItem

Represents an item type in Nova.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The configuration for this NovaItem. Trying to read config values from this when no config is present will result in an exception.

Link copied to clipboard
val craftingRemainingItem: ItemStack?

The ItemStack that is left over after this NovaItem was used in a crafting recipe.

Link copied to clipboard
val id: ResourceLocation
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val name: Component?
Link copied to clipboard
val style: Style

Functions

Link copied to clipboard
fun createItemBuilder(modelId: String = "default"): ItemBuilder

Creates an ItemBuilder for an ItemStack of this NovaItem, in server-side format.

Link copied to clipboard
fun createItemStack(amount: Int = 1, modelId: String = "default"): ItemStack

Creates an ItemStack of this NovaItem with the given amount and modelId in server-side format.

Link copied to clipboard
inline fun <T : Any> getBehavior(): T

Gets the first ItemBehavior that is an instance of T, or throws an IllegalStateException if there is none.

fun <T : Any> getBehavior(behavior: KClass<T>): T

Gets the first ItemBehavior that is an instance of behavior, or throws an IllegalStateException if there is none.

Link copied to clipboard
inline fun <T : Any> getBehaviorOrNull(): T?

Gets the first ItemBehavior that is an instance of T, or null if there is none.

fun <T : Any> getBehaviorOrNull(type: KClass<T>): T?

Gets the first ItemBehavior that is an instance of type or a subclass, or null if there is none.

Link copied to clipboard
inline fun <T : Any> hasBehavior(): Boolean

Checks whether this NovaItem has an ItemBehavior of the reified type T, or a subclass of it.

fun <T : Any> hasBehavior(type: KClass<T>): Boolean

Checks whether this NovaItem has an ItemBehavior of the specified class type, or a subclass of it.

Link copied to clipboard
open override fun toString(): String