Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,9 @@ public static Pair<SpecialHandler, ResourceKey<SpecialHandler.Factory<?>>> 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(since = "0.11.4")
public static PatternShapeMatch matchPattern(HexPattern pat, CastingEnvironment environment,
boolean checkForAlternateStrokeOrders) {
// I am PURPOSELY checking normal actions before special handlers
Expand Down Expand Up @@ -119,6 +118,14 @@ 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);
}

@Nullable
public static HexPattern getCanonicalStrokesPerWorld(ResourceKey<ActionRegistryEntry> key, ServerLevel overworld) {
var perWorldPatterns = ScrungledPatternsSave.open(overworld);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading