Class SpellCastResult

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

public final class SpellCastResult extends Object
Represents the result of a Spell cast. Holds the Spell itself, whether the Spell cast was successful, and an error message if one was set.
  • Constructor Details

    • SpellCastResult

      public SpellCastResult(Spell spell)
      Parameters:
      spell - The Spell to set on the result.
  • Method Details

    • isSuccess

      public boolean isSuccess()
      Returns:
      Whether the Spell cast was successful. A successful result triggers behavior such as mana consumption or affinity awarding.
    • setSuccess

      public SpellCastResult setSuccess()
      Marks the Spell cast as successful. A successful result triggers behavior such as mana consumption or affinity awarding. This is not reversible.
      Returns:
      This object, for chaining.
    • getSpell

      public Spell getSpell()
      Returns:
      The Spell of the result.
    • setSpell

      public SpellCastResult setSpell(Spell spell)
      Parameters:
      spell - The Spell to set on the result.
      Returns:
      This object, for chaining.
    • getMessage

      public @Nullable net.minecraft.network.chat.Component getMessage()
      Returns:
      The error message. May be null, which indicates that no error message was recorded.
    • setMessage

      public SpellCastResult setMessage(net.minecraft.network.chat.Component message)
      Sets the given error message if none was recorded yet. This behavior is to ensure that the earliest error message is returned.
      Parameters:
      message - The error message to set.
      Returns:
      This object, for chaining.