From e4c989a55d7bfec9dbb400b1bd07d7ee14efbcc1 Mon Sep 17 00:00:00 2001 From: Robotgiggle Date: Thu, 15 Jan 2026 22:59:08 -0500 Subject: [PATCH] Make the MishapInvalidIota lang fallback actually work --- .../api/casting/mishaps/MishapInvalidIota.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidIota.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidIota.kt index 2741b1df4..f7752c656 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidIota.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapInvalidIota.kt @@ -26,10 +26,13 @@ class MishapInvalidIota( 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()}" - ) + + // this translation key is preferred because it includes the namespace + var perpDesc = Component.translatableWithFallback("hexcasting.iota.${perpKey}.desc", "no desc found") + // for addons that don't implement the .desc key, grab the non-namespaced invalid_value key instead + if (perpDesc.getString() == "no desc found") + perpDesc = Component.translatable("hexcasting.mishap.invalid_value.class.${perpKey?.getPath()}") + return error( "invalid_value", expected, reverseIdx, perpDesc, perpetrator.display()