File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
java/at/petrak/hexcasting/api/casting
resources/assets/hexcasting/lang Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ public boolean toleratesOther(Iota that) {
9898 castedName = special .handler ::getName ;
9999 action = special .handler .act ();
100100 } else if (lookup instanceof PatternShapeMatch .Nothing ) {
101- throw new MishapInvalidPattern ();
101+ throw new MishapInvalidPattern (this . getPattern () );
102102 } else throw new IllegalStateException ();
103103
104104 // do the actual calculation!!
Original file line number Diff line number Diff line change @@ -4,10 +4,13 @@ import at.petrak.hexcasting.api.casting.eval.CastingEnvironment
44import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType
55import at.petrak.hexcasting.api.casting.iota.GarbageIota
66import at.petrak.hexcasting.api.casting.iota.Iota
7+ import at.petrak.hexcasting.api.casting.iota.PatternIota
8+ import at.petrak.hexcasting.api.casting.math.HexPattern
79import at.petrak.hexcasting.api.pigment.FrozenPigment
10+ import net.minecraft.network.chat.Component
811import net.minecraft.world.item.DyeColor
912
10- class MishapInvalidPattern : Mishap () {
13+ class MishapInvalidPattern ( val pattern : HexPattern ? = null ) : Mishap() {
1114 override fun accentColor (ctx : CastingEnvironment , errorCtx : Context ): FrozenPigment =
1215 dyeColor(DyeColor .YELLOW )
1316
@@ -17,6 +20,8 @@ class MishapInvalidPattern : Mishap() {
1720 stack.add(GarbageIota ())
1821 }
1922
20- override fun errorMessage (ctx : CastingEnvironment , errorCtx : Context ) =
21- error(" invalid_pattern" )
23+ override fun errorMessage (ctx : CastingEnvironment , errorCtx : Context ): Component ? {
24+ if (pattern == null ) return error(" invalid_pattern_generic" )
25+ else return error(" invalid_pattern" , PatternIota .display(pattern))
26+ }
2227}
Original file line number Diff line number Diff line change 984984 mishap : {
985985 "" : "%s: %s" ,
986986
987- invalid_pattern : "That pattern isn't associated with any action" ,
987+ invalid_pattern : "The pattern %s isn't associated with any action" ,
988+ invalid_pattern_generic : "That pattern isn't associated with any action" ,
988989 unescaped : "Expected to evaluate a pattern, but evaluated %s instead" ,
989990
990991 not_enough_args : "expected %s or more arguments but the stack was only %s tall" ,
You can’t perform that action at this time.
0 commit comments