Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- Massively improved ru_ru translations, by JustS-js and LedinecMing in [#832](https://github.com/FallingColors/HexMod/pull/832).
- Changed the invalid-pattern mishap to display the offending pattern, by Robotgiggle in [#951](https://github.com/FallingColors/HexMod/pull/951).
- Changed the invalid-iota mishap to display the type of the offending iota along with the iota itself, by Robotgiggle in [#951](https://github.com/FallingColors/HexMod/pull/951).
- Changed the disallowed-action mishap to properly display the offending action, by Robotgiggle in [#970](https://github.com/FallingColors/HexMod/pull/970).

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void precheckAction(PatternShapeMatch match) throws Mishap {
ResourceLocation key = actionKey(match);

if (!HexConfig.server().isActionAllowed(key)) {
throw new MishapDisallowedSpell();
throw new MishapDisallowedSpell("disallowed", key);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void precheckAction(PatternShapeMatch match) throws Mishap {
ResourceLocation key = actionKey(match);

if (!HexConfig.server().isActionAllowedInCircles(key)) {
throw new MishapDisallowedSpell("disallowed_circle");
throw new MishapDisallowedSpell("disallowed_circle", key);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ import at.petrak.hexcasting.api.casting.eval.CastingEnvironment
import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType
import at.petrak.hexcasting.api.casting.iota.Iota
import at.petrak.hexcasting.api.pigment.FrozenPigment
import at.petrak.hexcasting.api.utils.asTranslatedComponent
import net.minecraft.resources.ResourceLocation;
import net.minecraft.network.chat.Component
import net.minecraft.world.item.DyeColor

class MishapDisallowedSpell(val type: String = "disallowed") : Mishap() {
class MishapDisallowedSpell(val type: String, val actionKey: ResourceLocation?) : Mishap() {
@Deprecated("Provide the type (disallowed or disallowed_circle) and the action key that caused the mishap")
constructor(type: String = "disallowed") : this(type, null) {}

override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenPigment =
dyeColor(DyeColor.BLACK)

Expand All @@ -16,6 +22,8 @@ class MishapDisallowedSpell(val type: String = "disallowed") : Mishap() {
// NO-OP
}

override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) =
error(type)
override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context): Component? {
if (actionKey == null) return error(type + "_generic")
return error(type, "hexcasting.action.$actionKey".asTranslatedComponent)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1055,8 +1055,10 @@
},

no_akashic_record: "No Akashic Record at %s",
disallowed: "has been disallowed by the server admins",
disallowed_circle: "has been disallowed in spell circles by the server admins",
disallowed: "%s has been disallowed by the server admins",
disallowed_generic: "That pattern has been disallowed by the server admins",
disallowed_circle: "%s has been disallowed in spell circles by the server admins",
disallowed_circle_generic: "That pattern has been disallowed in spell circles by the server admins",
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.",
unknown: "threw an exception (%s). This is a bug in the mod.",
stack_size: "Exceeded the size limit of the stack",
Expand Down
Loading