File tree Expand file tree Collapse file tree 4 files changed +17
-7
lines changed
java/at/petrak/hexcasting/api/casting
resources/assets/hexcasting/lang Expand file tree Collapse file tree 4 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ public void precheckAction(PatternShapeMatch match) throws Mishap {
189189 ResourceLocation key = actionKey (match );
190190
191191 if (!HexConfig .server ().isActionAllowed (key )) {
192- throw new MishapDisallowedSpell ();
192+ throw new MishapDisallowedSpell ("disallowed" , key );
193193 }
194194 }
195195
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ public void precheckAction(PatternShapeMatch match) throws Mishap {
7272 ResourceLocation key = actionKey (match );
7373
7474 if (!HexConfig .server ().isActionAllowedInCircles (key )) {
75- throw new MishapDisallowedSpell ("disallowed_circle" );
75+ throw new MishapDisallowedSpell ("disallowed_circle" , key );
7676 }
7777 }
7878
Original file line number Diff line number Diff line change @@ -4,9 +4,15 @@ import at.petrak.hexcasting.api.casting.eval.CastingEnvironment
44import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType
55import at.petrak.hexcasting.api.casting.iota.Iota
66import at.petrak.hexcasting.api.pigment.FrozenPigment
7+ import at.petrak.hexcasting.api.utils.asTranslatedComponent
8+ import net.minecraft.resources.ResourceLocation;
9+ import net.minecraft.network.chat.Component
710import net.minecraft.world.item.DyeColor
811
9- class MishapDisallowedSpell (val type : String = " disallowed" ) : Mishap() {
12+ class MishapDisallowedSpell (val type : String , val actionKey : ResourceLocation ? ) : Mishap() {
13+ @Deprecated(" Provide the type (disallowed or disallowed_circle) and the action key that caused the mishap" )
14+ constructor (type: String = " disallowed" ) : this (type, null ) {}
15+
1016 override fun accentColor (ctx : CastingEnvironment , errorCtx : Context ): FrozenPigment =
1117 dyeColor(DyeColor .BLACK )
1218
@@ -16,6 +22,8 @@ class MishapDisallowedSpell(val type: String = "disallowed") : Mishap() {
1622 // NO-OP
1723 }
1824
19- override fun errorMessage (ctx : CastingEnvironment , errorCtx : Context ) =
20- error(type)
25+ override fun errorMessage (ctx : CastingEnvironment , errorCtx : Context ): Component ? {
26+ if (actionKey == null ) return error(type + " _generic" )
27+ return error(type, " hexcasting.action.$actionKey " .asTranslatedComponent)
28+ }
2129}
Original file line number Diff line number Diff line change 10551055 } ,
10561056
10571057 no_akashic_record : "No Akashic Record at %s" ,
1058- disallowed : "has been disallowed by the server admins" ,
1059- disallowed_circle : "has been disallowed in spell circles by the server admins" ,
1058+ disallowed : "%s has been disallowed by the server admins" ,
1059+ disallowed_generic : "That pattern has been disallowed by the server admins" ,
1060+ disallowed_circle : "%s has been disallowed in spell circles by the server admins" ,
1061+ disallowed_circle_generic : "That pattern has been disallowed in spell circles by the server admins" ,
10601062 invalid_spell_datum_type : "Tried to use a value of invalid type as a SpellDatum: %s (class %s). This is a bug in the mod." ,
10611063 unknown : "threw an exception (%s). This is a bug in the mod." ,
10621064 stack_size : "Exceeded the size limit of the stack" ,
You can’t perform that action at this time.
0 commit comments