From 7c261fc1502870cd53861b9d3a11b0aa923a6155 Mon Sep 17 00:00:00 2001 From: beholderface Date: Sun, 21 Jan 2024 01:40:20 -0500 Subject: [PATCH 1/4] fix weird dimensions sometimes having different great spells --- .../java/at/petrak/hexcasting/api/casting/iota/PatternIota.java | 2 +- .../petrak/hexcasting/common/command/PatternResLocArgument.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/PatternIota.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/PatternIota.java index e6c3a56a1f..24d2d104ae 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/PatternIota.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/iota/PatternIota.java @@ -69,7 +69,7 @@ public boolean toleratesOther(Iota that) { public @NotNull CastResult execute(CastingVM vm, ServerLevel world, SpellContinuation continuation) { @Nullable Component castedName = null; try { - var lookup = PatternRegistryManifest.matchPattern(this.getPattern(), world, false); + var lookup = PatternRegistryManifest.matchPattern(this.getPattern(), world.getServer().overworld(), false); vm.getEnv().precheckAction(lookup); Action action; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java b/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java index 8d5a1816a1..6403a422c9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/PatternResLocArgument.java @@ -47,7 +47,7 @@ public static HexPattern getPattern( CommandContext ctx, String argumentName) throws CommandSyntaxException { var targetId = ctx.getArgument(argumentName, ResourceLocation.class); var targetKey = ResourceKey.create(IXplatAbstractions.INSTANCE.getActionRegistry().key(), targetId); - var foundPat = PatternRegistryManifest.getCanonicalStrokesPerWorld(targetKey, ctx.getSource().getLevel()); + var foundPat = PatternRegistryManifest.getCanonicalStrokesPerWorld(targetKey, ctx.getSource().getServer().overworld()); if (foundPat == null) { throw ERROR_UNKNOWN_PATTERN.create(targetId); } else { From a4f122b7705c92c6df2cc8933cce6c4520a7aa95 Mon Sep 17 00:00:00 2001 From: beholderface Date: Tue, 18 Jun 2024 14:40:07 -0400 Subject: [PATCH 2/4] Make the flight spells cost zero if the target can already fly --- .../common/casting/actions/spells/OpFlight.kt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpFlight.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpFlight.kt index 9258cc059e..aa8e25682a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpFlight.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpFlight.kt @@ -35,11 +35,20 @@ class OpFlight(val type: Type) : SpellAction { val theArg = args.getPositiveDouble(1, argc) env.assertEntityInRange(target) - val cost = when (this.type) { + /*val cost = when (this.type) { Type.LimitRange -> theArg * MediaConstants.DUST_UNIT // A second of flight should cost 1 shard Type.LimitTime -> theArg * MediaConstants.SHARD_UNIT - }.roundToLong() + }.roundToLong()*/ + val cost = if(target.abilities.mayfly){ + 0L + } else { + when (this.type) { + Type.LimitRange -> theArg * MediaConstants.DUST_UNIT + // A second of flight should cost 1 shard + Type.LimitTime -> theArg * MediaConstants.SHARD_UNIT + }.roundToLong() + } // Convert to ticks return SpellAction.Result( From 8673a9d43c32b6662e843b0a9d51fbc47afad09f Mon Sep 17 00:00:00 2001 From: beholderface Date: Sun, 23 Jun 2024 19:12:04 -0400 Subject: [PATCH 3/4] Update Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpFlight.kt Co-authored-by: [object Object] --- .../petrak/hexcasting/common/casting/actions/spells/OpFlight.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpFlight.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpFlight.kt index aa8e25682a..a67378dab1 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpFlight.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpFlight.kt @@ -40,7 +40,7 @@ class OpFlight(val type: Type) : SpellAction { // A second of flight should cost 1 shard Type.LimitTime -> theArg * MediaConstants.SHARD_UNIT }.roundToLong()*/ - val cost = if(target.abilities.mayfly){ + val cost = if (target.abilities.mayfly) { 0L } else { when (this.type) { From 11045f31fc2fca0391156c52b49191f4a8d4b311 Mon Sep 17 00:00:00 2001 From: beholderface Date: Sun, 23 Jun 2024 19:17:25 -0400 Subject: [PATCH 4/4] Update OpFlight.kt just a comment explaining the zero cost thing --- .../hexcasting/common/casting/actions/spells/OpFlight.kt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpFlight.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpFlight.kt index a67378dab1..fcabf26d05 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpFlight.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpFlight.kt @@ -34,13 +34,9 @@ class OpFlight(val type: Type) : SpellAction { val target = args.getPlayer(0, argc) val theArg = args.getPositiveDouble(1, argc) env.assertEntityInRange(target) - - /*val cost = when (this.type) { - Type.LimitRange -> theArg * MediaConstants.DUST_UNIT - // A second of flight should cost 1 shard - Type.LimitTime -> theArg * MediaConstants.SHARD_UNIT - }.roundToLong()*/ + val cost = if (target.abilities.mayfly) { + //zero in order to not just waste media if you can already fly (see https://github.com/FallingColors/HexMod/pull/687 for some discussion) 0L } else { when (this.type) {