Skip to content
On this page

Fabric

PlayerEvent

top.katton.api.eventfabric/src/main/kotlin/top/katton/api/event/PlayerEvent.kt
Player interaction events for Fabric platform.

PlayerEvent

FabricObject
kotlin
@Suppress("unused")
object PlayerEvent

Player interaction events for Fabric platform.

This object provides events related to player interactions including attacking blocks/entities, using items, and interacting with blocks/entities.

PlayerEvent.onUseItemOn

FabricProperty
kotlin
val onUseItemOn

Event triggered when a player uses an item on a block.

Returns

InteractionResult.PASS to allow default behavior, or other result to override.

PlayerEvent.onUseWithoutItem

FabricProperty
kotlin
val onUseWithoutItem

Event triggered when a player interacts with a block without holding an item.

Returns

InteractionResult.PASS to allow default behavior, or other result to override.

PlayerEvent.onAttackBlock

FabricProperty
kotlin
val onAttackBlock

Event triggered when a player attacks (left-clicks) a block.

Returns

InteractionResult.PASS to allow default behavior, or other result to cancel/override.

PlayerEvent.onAttackEntity

FabricProperty
kotlin
val onAttackEntity

Event triggered when a player attacks (left-clicks) an entity.

Returns

InteractionResult.PASS to allow default behavior, or other result to cancel/override.

PlayerEvent.onBlockInteract

FabricProperty
kotlin
val onBlockInteract

Event triggered when a player interacts (right-clicks) with a block.

Returns

InteractionResult.PASS to allow default behavior, or other result to override.

PlayerEvent.onEntityInteract

FabricProperty
kotlin
val onEntityInteract

Event triggered when a player interacts (right-clicks) with an entity.

Returns

InteractionResult.PASS to allow default behavior, or other result to override.

PlayerEvent.onItemInteract

FabricProperty
kotlin
val onItemInteract

Event triggered when a player uses (right-clicks) an item.

Returns

InteractionResult.PASS to allow default behavior, or other result to override.

PlayerEvent.onDestroyItem

FabricProperty
kotlin
@JvmField
@JvmField val onDestroyItem

Event triggered when a player's item is destroyed (e.g., tool breaking).