Class SpellComponentCastResult
java.lang.Object
at.minecraftschurli.mods.arsmagicalegacy.api.spell.SpellComponentCastResult
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 Summary
Modifier and TypeMethodDescriptionstatic SpellComponentCastResult@Nullable net.minecraft.network.chat.ComponentgetSpell()booleanbooleanstatic SpellComponentCastResultstatic SpellComponentCastResult
-
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
-
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
- Returns:
- A new
SpellCastResultmarked as successful. A successful result triggers behavior such as mana consumption or affinity awarding.
-
pass
- Returns:
- A new
SpellCastResultmarked 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
SpellCastResultmarked as failing and with the given error message set.
-