NoHandAnimationWhileHolding

Disables the hand animation of pulling out the item while the item is being held, meaning that updating the item while the player is holding it will not play the animation again.

Does currently not work for switching between item types: MC-301863.

Properties

Link copied to clipboard

The base data components that every item with this ItemBehavior has.

Link copied to clipboard

The NamespacedCompound that every new ItemStack of an item with this ItemBehavior has by default.

Link copied to clipboard

The vanilla material properties that an item with this ItemBehavior requires.

Functions

Link copied to clipboard
open fun handleAttackEntity(player: Player, itemStack: ItemStack, attacked: Entity, event: EntityDamageByEntityEvent)

Called when an EntityDamageByEntityEvent is fired where player attacks attacked using itemStack with this behavior in their main hand.

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

Called when a BlockBreakActionEvent is fired where player breaks a block with an itemStack with this behavior.

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

Called when a aPlayerItemBreakEvent is fired where an itemStack with this behavior runs out of durability and breaks.

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

Called when a BlockBreakEvent is fired where player uses an itemStack with this behavior.

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

Called when a PlayerItemConsumeEvent is fired where player consumes an itemStack with this behavior.

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

Called when a PlayerItemDamageEvent is fired where an itemStack with this behavior takes damage.

Link copied to clipboard
open fun handleEntityInteract(player: Player, itemStack: ItemStack, clicked: Entity, event: PlayerInteractAtEntityEvent)

Called when a PlayerInteractAtEntityEvent is fired for an itemStack with this behavior.

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

Called when a EntityEquipmentChangedEvent is fired where player equips or unequips an itemStack with this behavior.

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

Called every tick for an itemStack with this behavior that is equipped by player in the given slot.

Link copied to clipboard
open fun handleInteract(player: Player, itemStack: ItemStack, action: Action, wrappedEvent: WrappedPlayerInteractEvent)

Called when a PlayerInteractEvent is fired for an itemStack with this behavior.

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

Called when an InventoryClickEvent is fired where player clicks on an itemStack with this behavior.

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

Called when an InventoryClickEvent is fired where player clicks on an itemStack with this behavior in their cursor.

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

Called when an InventoryClickEvent is fired where player swaps an item with a hotbar itemStack with this behavior.

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

Called every tick for an itemStack with this behavior that is in the player's inventory. The slot is the index inside the player inventory's contents.

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

Called when entity finishes using an itemStack with this behavior in hand.

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

Called when entity stops using an itemStack with this behavior in hand, with remainingUseTicks left.

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

Called every tick while an itemStack with this behavior is being used by entity in hand, with remainingUseTicks left.

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

Modifies the damage when player is breaking a block with itemStack. This damage is applied to the block every tick until 1.0 is reached, at which point the block is destroyed.

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

Updates the client-side item type for client-side item stacks to be viewed by player in place of the server-side item stack. This is called before modifyClientSideStack and influences the generation of the client-side ItemStack's patch. Called off-main thread.

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

Updates the client-side item stack that is to be viewed by player in place of the server-side item stack. Called off-main thread.

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

Modifies the server-side use duration of itemStack with this behavior for entity. The initial value of duration may stem from baseDataComponents. If the use duration is <= 0, the item cannot be used (no right click and hold action).

Link copied to clipboard
open fun modifyUseRemainder(entity: LivingEntity, original: ItemStack, hand: EquipmentSlot, remainder: ItemStack): ItemStack

Modifies the remainder when entity finishes using original with this behavior in hand.

Link copied to clipboard
open fun toString(itemStack: ItemStack): String

Creates a string representation of this ItemBehavior and its data in itemStack.