Class SpellCastEvent.Pre
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.LivingEvent
at.minecraftschurli.mods.arsmagicalegacy.api.event.SpellEvent
at.minecraftschurli.mods.arsmagicalegacy.api.event.SpellCastEvent
at.minecraftschurli.mods.arsmagicalegacy.api.event.SpellCastEvent.Pre
- 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.PreNested 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.LivingVisibilityEventNested 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 -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.network.chat.ComponentbooleanbooleanbooleanbooleanvoidsetAwardXp(boolean awardXp) Modify whether to award magic xp.voidsetCanceled(boolean canceled) Deprecated.voidsetCanceled(net.minecraft.network.chat.Component message) Mark the event as canceled.voidsetConsume(boolean consume) Modify whether to consume mana and burnout.voidMark the event as uncanceled.Methods inherited from class SpellCastEvent
getBurnout, getManaMethods inherited from class SpellEvent
getSpellMethods inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
getEntityMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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.UsesetCanceled(Component)to cancel, andsetUncanceled()to uncancel.- Specified by:
setCanceledin interfacenet.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.
-
setCanceled(Component)to cancel, andsetUncanceled()to uncancel.