Wearable

class Wearable(texture: Provider<Int?>, slot: Provider<EquipmentSlot>, armor: Provider<Double>, armorToughness: Provider<Double>, knockbackResistance: Provider<Double>, equipSound: Provider<String?>) : ItemBehavior

Allows items to be worn in armor slots.

Parameters

texture

The leather armor color used for the custom texture, or null if no custom texture should be used.

slot

The slot in which the item can be worn.

armor

The amount of armor this item provides.

armorToughness

The amount of armor toughness this item provides.

knockbackResistance

The amount of knockback resistance this item provides.

equipSound

The sound that is played when the item is equipped, or null if no sound should be played.

Constructors

Link copied to clipboard
constructor(texture: Provider<Int?>, slot: Provider<EquipmentSlot>, armor: Provider<Double>, armorToughness: Provider<Double>, knockbackResistance: Provider<Double>, equipSound: Provider<String?>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The amount of armor this item provides.

Link copied to clipboard

The amount of armor toughness this item provides.

Link copied to clipboard
open override val baseDataComponents: Provider<DataComponentMap>

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
open val defaultPatch: Provider<DataComponentPatch>

The data component patch that every new ItemStack of an item with this ItemBehavior has by default.

Link copied to clipboard

The sound that is played when the item is equipped.

Link copied to clipboard

The amount of knockback resistance this item provides.

Link copied to clipboard
val slot: EquipmentSlot

The slot in which the item can be worn.

Link copied to clipboard
val texture: Int?

The leather armor color used for the custom texture.

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)
Link copied to clipboard
open fun handleBlockBreakAction(player: Player, itemStack: ItemStack, event: BlockBreakActionEvent)
Link copied to clipboard
open fun handleBreak(player: Player, itemStack: ItemStack, event: PlayerItemBreakEvent)
Link copied to clipboard
open fun handleBreakBlock(player: Player, itemStack: ItemStack, event: BlockBreakEvent)
Link copied to clipboard
open fun handleDamage(player: Player, itemStack: ItemStack, event: PlayerItemDamageEvent)
Link copied to clipboard
open fun handleEntityInteract(player: Player, itemStack: ItemStack, clicked: Entity, event: PlayerInteractAtEntityEvent)
Link copied to clipboard
open fun handleEquip(player: Player, itemStack: ItemStack, equipped: Boolean, event: ArmorEquipEvent)
Link copied to clipboard
open override fun handleInteract(player: Player, itemStack: ItemStack, action: Action, wrappedEvent: WrappedPlayerInteractEvent)
Link copied to clipboard
open fun handleInventoryClick(player: Player, itemStack: ItemStack, event: InventoryClickEvent)
Link copied to clipboard
open fun handleInventoryClickOnCursor(player: Player, itemStack: ItemStack, event: InventoryClickEvent)
Link copied to clipboard
open fun handleInventoryHotbarSwap(player: Player, itemStack: ItemStack, event: InventoryClickEvent)
Link copied to clipboard
open fun handleRelease(player: Player, itemStack: ItemStack, event: ServerboundPlayerActionPacketEvent)
Link copied to clipboard
open fun modifyBlockDamage(player: Player, itemStack: ItemStack, 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 override fun modifyClientSideStack(player: Player?, itemStack: ItemStack, data: NamespacedCompound): ItemStack

Updates the client-side itemStack that is to be viewed by player and has server-side data.