Class TypedCallbackDispatcher
java.lang.Object
io.artificial.enchantments.internal.TypedCallbackDispatcher
Dispatches effects to typed callback handlers (EnchantmentEffectHandler implementations).
This dispatcher invokes the appropriate method on a handler based on the event type. It is called by the EffectDispatchSpine as the first path in the dual-path dispatch system.
The dispatcher maps DispatchEventType values to their corresponding handler methods:
- ENTITY_DAMAGE_BY_ENTITY → onEntityDamageByEntity(CombatContext)
- ENTITY_DAMAGE → onEntityDamage(CombatContext)
- SHIELD_BLOCK → onShieldBlock(CombatContext)
- BLOCK_BREAK → onBlockBreak(ToolContext)
- BLOCK_BREAK_PRE → onBlockBreakPre(ToolContext)
- BLOCK_PLACE → onBlockPlace(ToolContext)
- BLOCK_INTERACT → onBlockInteract(InteractionContext)
- ENTITY_INTERACT → onEntityInteract(InteractionContext)
- PROJECTILE_LAUNCH → onProjectileLaunch(ProjectileContext)
- PROJECTILE_HIT → onProjectileHit(ProjectileContext)
- FISHING_ACTION → onFishingAction(FishingContext)
- HELD_TICK → onHeldTick(TickContext)
- ARMOR_TICK → onArmorTick(TickContext)
- ITEM_USED → onItemUsed(ItemContext)
- DURABILITY_DAMAGE → onDurabilityDamage(ItemContext)
- ITEM_CONSUME → onItemConsume(ConsumableContext)
- BOW_SHOOT → onBowShoot(WeaponContext)
- TRIDENT_THROW → onTridentThrow(WeaponContext)
- ITEM_DROP → onItemDrop(ItemContext)
- ITEM_PICKUP → onItemPickup(ItemContext)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandispatch(@NotNull EnchantmentEffectHandler handler, @NotNull EffectContext context, EffectDispatchSpine.DispatchEventType eventType) Dispatches an effect to the appropriate handler method based on event type.
-
Constructor Details
-
TypedCallbackDispatcher
public TypedCallbackDispatcher()Creates a new typed callback dispatcher.- Since:
- 0.2.0
-
-
Method Details
-
dispatch
public boolean dispatch(@NotNull @NotNull EnchantmentEffectHandler handler, @NotNull @NotNull EffectContext context, @NotNull EffectDispatchSpine.DispatchEventType eventType) Dispatches an effect to the appropriate handler method based on event type.- Parameters:
handler- the effect handler to invokecontext- the effect context containing event dataeventType- the type of event to dispatch- Returns:
- true if the context was cancelled during handler execution, false otherwise
-