EffectiveEntityInteractable

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

RIGHT = right-click on the entity, LEFT = attacking it. Entities are matched by custom-entity key (falling back to org.bukkit.entity.EntityType).

Two ways to register:

  • EffectiveEntity.addInteractHandler — matches only that custom entity type (by key);

  • addInteractHandler directly with a plain, non-custom entity — since it has no key, matching falls back to org.bukkit.entity.EntityType, so the handler fires for every vanilla entity of that type (e.g. hook all cows). Handy when you want behaviour on a vanilla type, not a custom one.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Data(val target: EffectiveAbstractInteract.Target.Entity, val click: EffectiveAbstractInteract.Click, val callback: InteractCallback, val cooldownData: EffectiveAbstractInteract.CooldownData<EffectiveEntityInteractable.EventsCallOptions>? = null) : EffectiveAbstractInteract.Data<EffectiveEntityInteractable.EventsCallOptions>

A registered entity interact handler: target entity, Click, callback and optional cooldown.

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

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