From 06c7f97585280700a3c447cf986384949bcf32c4 Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Sun, 12 Jun 2022 20:29:47 -0500 Subject: [PATCH] whoops --- .../hexcasting/api/spell/casting/CastingHarness.kt | 7 ++++--- .../hexcasting/api/spell/casting/SpellContinuation.kt | 9 ++------- .../common/casting/operators/stack/OpFisherman.kt | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt index cc44f303..35e42293 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/CastingHarness.kt @@ -135,12 +135,13 @@ class CastingHarness private constructor( fun updateWithPattern(newPat: HexPattern, world: ServerLevel, continuation: SpellContinuation): CastResult { var operatorIdPair: Pair? = null try { - // Don't catch this one operatorIdPair = PatternRegistry.matchPatternAndID(newPat, world) - if (!HexConfig.server().isActionAllowed(operatorIdPair.second)) { + if (this.ctx.spellCircle == null && !HexConfig.server().isActionAllowed(operatorIdPair.second)) { throw MishapDisallowedSpell() - } else if (this.ctx.spellCircle != null && !HexConfig.server().isActionAllowedInCircles(operatorIdPair.second)) { + } else if (this.ctx.spellCircle != null + && !HexConfig.server().isActionAllowedInCircles(operatorIdPair.second) + ) { throw MishapDisallowedSpell("disallowed_circle") } diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/SpellContinuation.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/SpellContinuation.kt index aa7cbb68..b1fc6efe 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/SpellContinuation.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/casting/SpellContinuation.kt @@ -1,17 +1,12 @@ package at.petrak.hexcasting.api.spell.casting -import at.petrak.hexcasting.api.spell.SpellDatum -import at.petrak.hexcasting.api.spell.SpellList -import at.petrak.hexcasting.api.spell.casting.CastingHarness.CastResult -import net.minecraft.server.level.ServerLevel - /** * A continuation during the execution of a spell. */ sealed interface SpellContinuation { - object Done: SpellContinuation {} + object Done : SpellContinuation - data class NotDone(val frame: ContinuationFrame, val next: SpellContinuation): SpellContinuation {} + data class NotDone(val frame: ContinuationFrame, val next: SpellContinuation) : SpellContinuation fun pushFrame(frame: ContinuationFrame): SpellContinuation = NotDone(frame, this) } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt index 4974a9d6..0623f905 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/stack/OpFisherman.kt @@ -20,7 +20,7 @@ object OpFisherman : Operator { ctx: CastingContext ): OperationResult { if (stack.size < 2) - throw MishapNotEnoughArgs(2, 0) + throw MishapNotEnoughArgs(2, stack.size) val arg = stack.getChecked(stack.lastIndex) val datum = stack[stack.lastIndex] val distance = stack.size - (arg + 1) // because getChecked just gives me a double for some reason