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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- Re-added the slate limit for spell circles, by Stickia in [#909](https://github.com/FallingColors/HexMod/pull/909).
- Renamed Inverse Tangent Purification II to Inverse Tangent Distillation, by Robotgiggle in [#921](https://github.com/FallingColors/HexMod/pull/921).
- 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).

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public boolean toleratesOther(Iota that) {
castedName = special.handler::getName;
action = special.handler.act();
} else if (lookup instanceof PatternShapeMatch.Nothing) {
throw new MishapInvalidPattern();
throw new MishapInvalidPattern(this.getPattern());
} else throw new IllegalStateException();

// do the actual calculation!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import at.petrak.hexcasting.api.casting.iota.GarbageIota
import at.petrak.hexcasting.api.casting.iota.Iota
import at.petrak.hexcasting.api.pigment.FrozenPigment
import at.petrak.hexcasting.api.utils.asTranslatedComponent
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes
import net.minecraft.network.chat.Component
import net.minecraft.world.item.DyeColor

Expand All @@ -23,11 +24,17 @@ class MishapInvalidIota(
stack[stack.size - 1 - reverseIdx] = GarbageIota();
}

override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) =
error(
override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context): Component? {
val perpKey = HexIotaTypes.REGISTRY.getKey(perpetrator.getType())
val perpDesc = Component.translatableWithFallback(
"hexcasting.iota.${perpKey}.desc",
"hexcasting.mishap.invalid_value.class.${perpKey?.getPath()}"
)
return error(
"invalid_value", expected, reverseIdx,
perpetrator.display()
perpDesc, perpetrator.display()
)
}

companion object {
@JvmStatic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ import at.petrak.hexcasting.api.casting.eval.CastingEnvironment
import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType
import at.petrak.hexcasting.api.casting.iota.GarbageIota
import at.petrak.hexcasting.api.casting.iota.Iota
import at.petrak.hexcasting.api.casting.iota.PatternIota
import at.petrak.hexcasting.api.casting.math.HexPattern
import at.petrak.hexcasting.api.pigment.FrozenPigment
import net.minecraft.network.chat.Component
import net.minecraft.world.item.DyeColor

class MishapInvalidPattern : Mishap() {
class MishapInvalidPattern(val pattern: HexPattern?) : Mishap() {
@Deprecated("Provide the pattern that caused the mishap as an argument")
constructor() : this(null) {}

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

Expand All @@ -17,6 +23,8 @@ class MishapInvalidPattern : Mishap() {
stack.add(GarbageIota())
}

override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context) =
error("invalid_pattern")
override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context): Component? {
if (pattern == null) return error("invalid_pattern_generic")
return error("invalid_pattern", PatternIota.display(pattern))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -969,22 +969,51 @@
escape: "Consideration",
undo: "Evanition",
},

"iota.hexcasting:": {
"null": "Null",
double: "Number",
boolean: "Boolean",
entity: "Entity",
list: "List",
pattern: "Pattern",
garbage: "Garbage",
vec3: "Vector",
null: {
"": "Null",
desc: "a null value",
},
double: {
"": "Number",
desc: "a number",
},
boolean: {
"": "Boolean",
desc: "a boolean",
},
entity: {
"": "Entity",
desc: "an entity",
},
list: {
"": "List",
desc: "a list",
},
pattern: {
"": "Pattern",
desc: "a pattern",
},
garbage: {
"": "Garbage",
desc: "garbage",
},
vec3: {
"": "Vector",
desc: "a vector",
},
continution: {
"": "Continuation",
desc: "a jump iota",
},
},

mishap: {
"": "%s: %s",

invalid_pattern: "That pattern isn't associated with any action",
invalid_pattern: "The pattern %s isn't associated with any action",
invalid_pattern_generic: "That pattern isn't associated with any action",
unescaped: "Expected to evaluate a pattern, but evaluated %s instead",

not_enough_args: "expected %s or more arguments but the stack was only %s tall",
Expand Down Expand Up @@ -1034,15 +1063,17 @@
bad_caster: "Tried to execute a pattern that requires a greater mind",

invalid_value: {
"": "expected %s at index %s of the stack, but got %s",
"": "expected %s at index %s of the stack, but got %s: %s",

class: {
double: "a number",
boolean: "a boolean",
vector: "a vector",
list: "a list",
widget: "an influence",
pattern: "a pattern",
continuation: "a jump iota",
garbage: "garbage",
null: "null",

entity: {
"": "an entity",
Expand Down
Loading