Class SpellComponentCastResult

java.lang.Object
at.minecraftschurli.mods.arsmagicalegacy.api.spell.SpellComponentCastResult

public final class SpellComponentCastResult extends Object
Represents the result of an individual SpellPart being cast. The result is then used to accordingly populate a SpellCastResult. Get an instance via success(Spell), pass(Spell) or failure(Spell, Component).
  • Method Details

    • isSuccess

      public boolean isSuccess()
      Returns:
      Whether the result is considered successful. A successful result triggers behavior such as mana consumption or affinity awarding.
    • isFailure

      public boolean isFailure()
      Returns:
      Whether the result is considered failing.
    • getSpell

      public Spell getSpell()
      Returns:
      The Spell contained in the result.
    • getMessage

      public @Nullable net.minecraft.network.chat.Component getMessage()
      Returns:
      The error message. This will be a non-null value iff isFailure() returns true.
    • success

      public static SpellComponentCastResult success(Spell spell)
      Returns:
      A new SpellCastResult marked as successful. A successful result triggers behavior such as mana consumption or affinity awarding.
    • pass

      public static SpellComponentCastResult pass(Spell spell)
      Returns:
      A new SpellCastResult marked as neither successful nor failing. This should be used e.g. when only running code on one side.
    • failure

      public static SpellComponentCastResult failure(Spell spell, net.minecraft.network.chat.Component message)
      Parameters:
      message - The error message to set.
      Returns:
      A new SpellCastResult marked as failing and with the given error message set.