From 49ef1c225dd2b33024bc9372896a599ef5871630 Mon Sep 17 00:00:00 2001 From: beholderface Date: Sat, 8 Feb 2025 12:59:27 -0500 Subject: [PATCH 1/4] Stop fake players from bloodcasting --- .../hexcasting/api/casting/eval/env/PlayerBasedCastEnv.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/env/PlayerBasedCastEnv.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/env/PlayerBasedCastEnv.java index 750a48fa23..edf64f2cbb 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/env/PlayerBasedCastEnv.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/env/PlayerBasedCastEnv.java @@ -175,6 +175,10 @@ protected long extractMediaFromInventory(long costLeft, boolean allowOvercast, b } protected boolean canOvercast() { + //bad deployer, no more infinite bloodcasting for you + if (this.caster.getClass() != ServerPlayer.class){ + return false; + } var adv = this.world.getServer().getAdvancements().getAdvancement(modLoc("y_u_no_cast_angy")); var advs = this.caster.getAdvancements(); return advs.getOrStartProgress(adv).isDone(); From fe4813085ec6cc86452fb3c484ea5eba10cc2dfd Mon Sep 17 00:00:00 2001 From: beholderface <13290805+beholderface@users.noreply.github.com> Date: Wed, 18 Feb 2026 09:02:32 -0500 Subject: [PATCH 2/4] deprecate the original matchpattern --- .../at/petrak/hexcasting/api/casting/iota/PatternIota.java | 2 +- .../hexcasting/common/casting/PatternRegistryManifest.java | 5 +++++ .../petrak/hexcasting/interop/inline/InlinePatternData.java | 2 +- 3 files changed, 7 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 74db0a95fb..097fae52ae 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 @@ -71,7 +71,7 @@ public boolean toleratesOther(Iota that) { public @NotNull CastResult execute(CastingVM vm, ServerLevel world, SpellContinuation continuation) { Supplier<@Nullable Component> castedName = () -> null; try { - var lookup = PatternRegistryManifest.matchPattern(this.getPattern(), vm.getEnv(), false); + var lookup = PatternRegistryManifest.matchPattern(this.getPattern(), vm.getEnv()); vm.getEnv().precheckAction(lookup); Action action; diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java index 5d15f8fe42..2aad053352 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java @@ -90,6 +90,7 @@ public static Pair>> match * order * for a per-world pattern. */ + @Deprecated public static PatternShapeMatch matchPattern(HexPattern pat, CastingEnvironment environment, boolean checkForAlternateStrokeOrders) { // I am PURPOSELY checking normal actions before special handlers @@ -119,6 +120,10 @@ public static PatternShapeMatch matchPattern(HexPattern pat, CastingEnvironment return new PatternShapeMatch.Nothing(); } + public static PatternShapeMatch matchPattern(HexPattern pattern, CastingEnvironment environment){ + return matchPattern(pattern, environment, false); + } + @Nullable public static HexPattern getCanonicalStrokesPerWorld(ResourceKey key, ServerLevel overworld) { var perWorldPatterns = ScrungledPatternsSave.open(overworld); diff --git a/Common/src/main/java/at/petrak/hexcasting/interop/inline/InlinePatternData.java b/Common/src/main/java/at/petrak/hexcasting/interop/inline/InlinePatternData.java index 5dc2dba2ff..e19bb21571 100644 --- a/Common/src/main/java/at/petrak/hexcasting/interop/inline/InlinePatternData.java +++ b/Common/src/main/java/at/petrak/hexcasting/interop/inline/InlinePatternData.java @@ -50,7 +50,7 @@ public Style getExtraStyle() { public static Component getPatternName(HexPattern pattern){ try { - PatternShapeMatch shapeMatch = PatternRegistryManifest.matchPattern(pattern, null, false); + PatternShapeMatch shapeMatch = PatternRegistryManifest.matchPattern(pattern, null); if(shapeMatch instanceof PatternShapeMatch.Normal normMatch){ return HexAPI.instance().getActionI18n(normMatch.key, false); } From 223f8467f946dc857b2db8ae5321d88966b70fd3 Mon Sep 17 00:00:00 2001 From: beholderface <13290805+beholderface@users.noreply.github.com> Date: Thu, 19 Feb 2026 10:01:19 -0500 Subject: [PATCH 3/4] address pr comments --- .../api/casting/eval/env/PlayerBasedCastEnv.java | 4 ---- .../common/casting/PatternRegistryManifest.java | 8 +++++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/env/PlayerBasedCastEnv.java b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/env/PlayerBasedCastEnv.java index f411cd8c2a..1f5b6703ff 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/env/PlayerBasedCastEnv.java +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/eval/env/PlayerBasedCastEnv.java @@ -192,10 +192,6 @@ protected long extractMediaFromInventory(long costLeft, boolean allowOvercast, b } protected boolean canOvercast() { - //bad deployer, no more infinite bloodcasting for you - if (this.caster.getClass() != ServerPlayer.class){ - return false; - } var adv = this.world.getServer().getAdvancements().getAdvancement(modLoc("y_u_no_cast_angy")); var advs = this.caster.getAdvancements(); return advs.getOrStartProgress(adv).isDone(); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java index 2aad053352..b297bdc5e7 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java @@ -86,9 +86,7 @@ public static Pair>> match * Try to match this pattern to an action, whether via a normal pattern, a per-world pattern, or the machinations * of a special handler. * - * @param checkForAlternateStrokeOrders if this is true, will check if the pattern given is an erroneous stroke - * order - * for a per-world pattern. + * @deprecated Giving this method a true will cause it to throw if it cannot find a normal or per-world pattern match. Use the bool-less overload instead. */ @Deprecated public static PatternShapeMatch matchPattern(HexPattern pat, CastingEnvironment environment, @@ -120,6 +118,10 @@ public static PatternShapeMatch matchPattern(HexPattern pat, CastingEnvironment return new PatternShapeMatch.Nothing(); } + /** + * Try to match this pattern to an action, whether via a normal pattern, a per-world pattern, or the machinations + * of a special handler. Will never attempt to check alternate stroke orders, which always throws. + */ public static PatternShapeMatch matchPattern(HexPattern pattern, CastingEnvironment environment){ return matchPattern(pattern, environment, false); } From d2efc75410752183c2ea6a919632d6729a105895 Mon Sep 17 00:00:00 2001 From: beholderface <13290805+beholderface@users.noreply.github.com> Date: Fri, 20 Feb 2026 11:00:31 -0500 Subject: [PATCH 4/4] since --- .../hexcasting/common/casting/PatternRegistryManifest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java index b297bdc5e7..7897213981 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/PatternRegistryManifest.java @@ -88,7 +88,7 @@ public static Pair>> match * * @deprecated Giving this method a true will cause it to throw if it cannot find a normal or per-world pattern match. Use the bool-less overload instead. */ - @Deprecated + @Deprecated(since = "0.11.4") public static PatternShapeMatch matchPattern(HexPattern pat, CastingEnvironment environment, boolean checkForAlternateStrokeOrders) { // I am PURPOSELY checking normal actions before special handlers