EffectiveBlockInteractable

Behaviour that dispatches left/right interactions on custom blocks, mirroring ru.hukm.effectiveSpigot.minecraft.items.interfaces.EffectiveClickable for items and ru.hukm.effectiveSpigot.minecraft.entities.interfaces.EffectiveEntityInteractable for entities.

RIGHT = right-click on the block, LEFT = left-click (attack) it. Blocks are matched by their custom-block type (note-block state) via EffectiveBlock.getEffectiveBlock. Register through EffectiveBlock.addInteractHandler on the block instance.

Callback result:

  • EffectiveAbstractInteract.Result.CANCEL_EVENT cancels the underlying PlayerInteractEvent.

  • EffectiveAbstractInteract.Result.ALLOW_EVENT lets the vanilla interaction proceed.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Data(val target: EffectiveAbstractInteract.Target.Block, val click: EffectiveAbstractInteract.Click, val callback: InteractCallback) : EffectiveAbstractInteract.Data<EffectiveBlockInteractable.EventsCallOptions>

A registered block interact handler: target block type, Click and callback. Blocks have no cooldown.

Link copied to clipboard
data class EventsCallOptions(val player: Player, val target: EffectiveAbstractInteract.Target.Block, val click: EffectiveAbstractInteract.Click, val hand: EquipmentSlot, val blockFace: BlockFace) : EffectiveAbstractInteract.EventsCallOptions<EffectiveAbstractInteract.Target.Block>

Context passed to an InteractCallback: the player, the clicked block, the click type, hand and face.