Shield

class Shield(blockDelay: Provider<Int>, disableCooldownScale: Provider<Double>, bypassedBy: Provider<TagKey<DamageType>?>, blockSound: Provider<Key?>, disableSound: Provider<Key?>) : ItemBehavior

Parameters

blockDelay

The number of ticks that right-click must be held before successfully blocking attacks.

disableCooldownScale

A multiplier that is applied to the number of ticks that the item will be on cooldown for when attacked by a disabling attack.

bypassedBy

A damage type tag containing the damage types that bypass the shield. Can be null if no damage types bypass the shield.

blockSound

The sound that is played when the shield successfully blocks an attack. Can be null if no sound should be played.

disableSound

The sound that is played when the shield is disabled by a disabling attack. Can be null if no sound should be played.

Constructors

Link copied to clipboard
constructor(blockDelay: Provider<Int>, disableCooldownScale: Provider<Double>, bypassedBy: Provider<TagKey<DamageType>?>, blockSound: Provider<Key?>, disableSound: Provider<Key?>)

Properties

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 number of ticks that right-click must be held before successfully blocking attacks.

Link copied to clipboard
val blockSound: Sound?

The sound that is played when the shield successfully blocks an attack.

Link copied to clipboard
val blockSoundKey: Key?

The key of the sound that is played when the shield successfully blocks an attack.

Link copied to clipboard
val bypassedBy: TagKey<DamageType>?

A damage type tag containing the damage types that bypass the shield.

Link copied to clipboard

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

Link copied to clipboard

A multiplier that is applied to the number of ticks that the item will be on cooldown for when attacked by a disabling attack.

Link copied to clipboard
val disableSound: Sound?

The sound that is played when the shield is disabled by a disabling attack.

Link copied to clipboard
val disableSoundKey: Key?

The key of the sound that is played when the shield is disabled by a disabling attack.

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 handleConsume(player: Player, itemStack: ItemStack, event: PlayerItemConsumeEvent)
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, slot: EquipmentSlot, equipped: Boolean, event: EntityEquipmentChangedEvent)
Link copied to clipboard
open 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 handleInventoryTick(player: Player, itemStack: ItemStack, slot: Int)
Link copied to clipboard
open fun handleRelease(player: Player, itemStack: ItemStack, event: ServerboundPlayerActionPacketEvent)
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 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.

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

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