NovaItem

class NovaItem

Represents a custom Nova item type.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The base data components of this NovaItem.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val clientsideProvider: ItemProvider

An ItemProvider containing the client-side ItemStack of this NovaItem, intended for use in Guis.

Link copied to clipboard
val config: Provider<CommentedConfigurationNode>

The configuration for this NovaItem. May be an empty node if the config file does not exist.

Link copied to clipboard
val craftingRemainingItem: ItemStack

The ItemStack that is left over after this NovaItem was used in a crafting recipe, or an empty stack if there is no remainder.

Link copied to clipboard
val id: Key
Link copied to clipboard
Link copied to clipboard
val lore: List<Component>
Link copied to clipboard
Link copied to clipboard
val name: Component?
Link copied to clipboard
val style: Style
Link copied to clipboard

Functions

Link copied to clipboard
fun createClientsideItemBuilder(): ItemBuilder

Creates an ItemBuilder for an ItemStack of this NovaItem, in client-side format, intended for use in Guis.

Link copied to clipboard
fun createItemBuilder(): ItemBuilder

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

Link copied to clipboard
fun createItemStack(amount: Int = 1): ItemStack

Creates an ItemStack of this NovaItem with the given amount 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: Class<T>): T
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: Class<T>): T?
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
fun handleAttackEntity(player: Player, itemStack: ItemStack, attacked: Entity, event: EntityDamageByEntityEvent)

Handles event where player attacks attacked using itemStack with this NovaItem in their main hand.

Link copied to clipboard
fun handleBlockBreakAction(player: Player, itemStack: ItemStack, event: BlockBreakActionEvent)

Handles event where player performs a block break action using itemStack with this NovaItem.

Link copied to clipboard
fun handleBreak(player: Player, itemStack: ItemStack, event: PlayerItemBreakEvent)

Handles event where player breaks itemStack with this NovaItem.

Link copied to clipboard
fun handleBreakBlock(player: Player, itemStack: ItemStack, event: BlockBreakEvent)

Handles event where player breaks a block using itemStack with this NovaItem.

Link copied to clipboard
fun handleConsume(player: Player, itemStack: ItemStack, event: PlayerItemConsumeEvent)

Handles event where player consumes itemStack with this NovaItem.

Link copied to clipboard
fun handleDamage(player: Player, itemStack: ItemStack, event: PlayerItemDamageEvent)

Handles event where player damages itemStack with this NovaItem.

Link copied to clipboard
fun handleEquip(player: Player, itemStack: ItemStack, slot: EquipmentSlot, equipped: Boolean, event: EntityEquipmentChangedEvent)

Handles event where player equips or unequips (equipped) itemStack with this NovaItem in slot.

Link copied to clipboard
fun handleEquipmentTick(player: Player, itemStack: ItemStack, slot: EquipmentSlot)

Handles an equipment tick for player with itemStack with this NovaItem in slot.

Link copied to clipboard
fun handleInventoryClick(player: Player, itemStack: ItemStack, event: InventoryClickEvent)

Handles event where player clicks on itemStack with this NovaItem in an inventory.

Link copied to clipboard
fun handleInventoryClickOnCursor(player: Player, itemStack: ItemStack, event: InventoryClickEvent)

Handles event where player clicks on a slot with itemStack with this NovaItem on their cursor.

Link copied to clipboard
fun handleInventoryHotbarSwap(player: Player, itemStack: ItemStack, event: InventoryClickEvent)

Handles event where player swaps itemStack with this NovaItem via hotbar swap.

Link copied to clipboard
fun handleInventoryTick(player: Player, itemStack: ItemStack, slot: Int)

Handles an inventory tick for player with itemStack with this NovaItem in slot.

Link copied to clipboard
fun handleUseFinished(entity: LivingEntity, itemStack: ItemStack, hand: EquipmentSlot): ItemAction

Handles the use of itemStack with this NovaItem finishing for entity in hand.

Link copied to clipboard
fun handleUseStopped(entity: LivingEntity, itemStack: ItemStack, hand: EquipmentSlot, remainingUseTicks: Int)

Handles the use of itemStack with this NovaItem being stopped for entity in hand and remainingUseTicks left.

Link copied to clipboard
fun handleUseTick(entity: LivingEntity, itemStack: ItemStack, hand: EquipmentSlot, passedUseTicks: Int, remainingUseTicks: Int)

Handles a use tick for entity with itemStack with this NovaItem in hand with passedUseTicks passed and remainingUseTicks remaining.

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: Class<T>): Boolean
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.

Checks whether this NovaItem has the specific behavior instance.

Link copied to clipboard
fun modifyBlockDamage(player: Player, itemStack: ItemStack, block: Block, damage: Double): Double

Modifies the block damage of this NovaItem when using itemStack to break block.

Link copied to clipboard
fun modifyClientSideItemType(player: Player?, server: ItemStack, client: Material): Material

Modifies the client-side item type of this NovaItem, in the context that it is sent to player and has server data.

Link copied to clipboard
fun modifyClientSideStack(player: Player?, server: ItemStack, client: ItemStack): ItemStack

Modifies the client-side stack of this NovaItem, in the context that it is sent to player and has data.

Link copied to clipboard
fun modifyUseDuration(entity: LivingEntity, itemStack: ItemStack, duration: Int): Int

Modifies the use duration of itemStack with this NovaItem for entity.

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

Handles using this NovaItem in the given ctx.

Link copied to clipboard

Handles using this NovaItem on a block in the given ctx.

Link copied to clipboard

Handles using this NovaItem on an entity in the given ctx.