HexCasting/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapDisallowedSpell.kt

22 lines
830 B
Kotlin

package at.petrak.hexcasting.api.casting.mishaps
import at.petrak.hexcasting.api.casting.eval.CastingEnvironment
import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType
import at.petrak.hexcasting.api.casting.iota.Iota
import at.petrak.hexcasting.api.pigment.FrozenPigment
import net.minecraft.world.item.DyeColor
class MishapDisallowedSpell(val type: String = "disallowed") : Mishap() {
override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenPigment =
dyeColor(DyeColor.BLACK)
override fun resolutionType(ctx: CastingEnvironment) = ResolvedPatternType.INVALID
override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList<Iota>) {
// NO-OP
}
override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) =
error(type)
}