Class SpellCastEvent.Pre

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.LivingEvent
All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
Enclosing class:
SpellCastEvent

public static class SpellCastEvent.Pre extends SpellCastEvent implements net.neoforged.bus.api.ICancellableEvent

Fired immediately before the spell is cast. Use this event to modify whether to consume mana and burnout, and whether to award magic xp.

This event is cancelable. If the event is canceled, the spell will not be cast.

  • Nested Class Summary

    Nested classes/interfaces inherited from class SpellCastEvent

    SpellCastEvent.Post, SpellCastEvent.Pre

    Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent

    net.neoforged.neoforge.event.entity.living.LivingEvent.LivingJumpEvent, net.neoforged.neoforge.event.entity.living.LivingEvent.LivingVisibilityEvent

    Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent

    net.neoforged.neoforge.event.entity.EntityEvent.EnteringSection, net.neoforged.neoforge.event.entity.EntityEvent.EntityConstructing, net.neoforged.neoforge.event.entity.EntityEvent.Size
  • Constructor Summary

    Constructors
    Constructor
    Description
    Pre(net.minecraft.world.entity.LivingEntity entity, Spell spell, double mana, double burnout, boolean consume, boolean awardXp)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.network.chat.Component
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    void
    setAwardXp(boolean awardXp)
    Modify whether to award magic xp.
    void
    setCanceled(boolean canceled)
    Deprecated.
    Use setCanceled(Component) to cancel, and setUncanceled() to uncancel.
    void
    setCanceled(net.minecraft.network.chat.Component message)
    Mark the event as canceled.
    void
    setConsume(boolean consume)
    Modify whether to consume mana and burnout.
    void
    Mark the event as uncanceled.

    Methods inherited from class SpellCastEvent

    getBurnout, getMana

    Methods inherited from class SpellEvent

    getSpell

    Methods inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent

    getEntity

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.neoforged.bus.api.ICancellableEvent

    isCanceled
  • Constructor Details

    • Pre

      public Pre(net.minecraft.world.entity.LivingEntity entity, Spell spell, double mana, double burnout, boolean consume, boolean awardXp)
  • Method Details

    • isOriginalConsume

      public boolean isOriginalConsume()
      Returns:
      Whether to consume mana and burnout.
    • isOriginalAwardXp

      public boolean isOriginalAwardXp()
      Returns:
      Whether to award magic xp.
    • isConsume

      public boolean isConsume()
      Returns:
      Whether to consume mana and burnout. Potentially modified.
    • setConsume

      public void setConsume(boolean consume)
      Modify whether to consume mana and burnout.
      Parameters:
      consume - Whether to consume mana and burnout.
    • isAwardXp

      public boolean isAwardXp()
      Returns:
      Whether to award magic xp. Potentially modified.
    • setAwardXp

      public void setAwardXp(boolean awardXp)
      Modify whether to award magic xp.
      Parameters:
      awardXp - Whether to award magic xp.
    • setCanceled

      @Deprecated public void setCanceled(boolean canceled)
      Deprecated.
      Use setCanceled(Component) to cancel, and setUncanceled() to uncancel.
      Specified by:
      setCanceled in interface net.neoforged.bus.api.ICancellableEvent
    • setCanceled

      public void setCanceled(net.minecraft.network.chat.Component message)
      Mark the event as canceled.
      Parameters:
      message - The cancellation reason. This will be displayed to the player as a status message.
    • setUncanceled

      public void setUncanceled()
      Mark the event as uncanceled.
    • getCancellationMessage

      public net.minecraft.network.chat.Component getCancellationMessage()
      Returns:
      The cancellation reason. This will be displayed to the player as a status message.