diff --git a/xplat/src/main/java/fzzyhmstrs/emi_loot/emi/ArchaeologyLootRecipe.java b/xplat/src/main/java/fzzyhmstrs/emi_loot/emi/ArchaeologyLootRecipe.java index ac807d1b..ea35fc25 100644 --- a/xplat/src/main/java/fzzyhmstrs/emi_loot/emi/ArchaeologyLootRecipe.java +++ b/xplat/src/main/java/fzzyhmstrs/emi_loot/emi/ArchaeologyLootRecipe.java @@ -59,12 +59,21 @@ public ArchaeologyLootRecipe(ClientArchaeologyLootTable loot) { MutableText text = LText.translatable(key); MutableText rawTitle; if(!I18n.hasTranslation(key)) { + StringBuilder archName = new StringBuilder(); + String[] chestPathTokens = loot.id.getPath().split("[/_]"); + for (String str : chestPathTokens) { + if (str.length() <= 1) { + archName.append(" ").append(str); + } else { + archName.append(" ").append(str.substring(0, 1).toUpperCase()).append(str.substring(1)); + } + } if(EMILootAgnos.isModLoaded(loot.id.getNamespace())) { String modName = EMILootAgnos.getModName(loot.id.getNamespace()); - rawTitle = LText.translatable("emi_loot.archaeology.unknown_archaeology", modName); + rawTitle = LText.translatable("emi_loot.archaeology.unknown_archaeology", archName.toString() + modName); } else { Text unknown = LText.translatable("emi_loot.archaeology.unknown"); - rawTitle = LText.translatable("emi_loot.archaeology.unknown_archaeology", unknown.getString()); + rawTitle = LText.translatable("emi_loot.archaeology.unknown_archaeology", archName.toString() + unknown.getString()); } if (EMILoot.config.isLogI18n(EMILoot.Type.ARCHAEOLOGY)) { EMILoot.LOGGER.warn("Untranslated archaeology loot table \"" + loot.id + "\" (key: \"" + key + "\")"); diff --git a/xplat/src/main/java/fzzyhmstrs/emi_loot/emi/ChestLootRecipe.java b/xplat/src/main/java/fzzyhmstrs/emi_loot/emi/ChestLootRecipe.java index e0262994..73d271eb 100644 --- a/xplat/src/main/java/fzzyhmstrs/emi_loot/emi/ChestLootRecipe.java +++ b/xplat/src/main/java/fzzyhmstrs/emi_loot/emi/ChestLootRecipe.java @@ -57,12 +57,21 @@ public ChestLootRecipe(ClientChestLootTable loot) { MutableText text = LText.translatable(key); MutableText rawTitle; if (!I18n.hasTranslation(key)) { + StringBuilder chestName = new StringBuilder(); + String[] chestPathTokens = loot.id.getPath().split("[/_]"); + for (String str : chestPathTokens) { + if (str.length() <= 1) { + chestName.append(" ").append(str); + } else { + chestName.append(" ").append(str.substring(0, 1).toUpperCase()).append(str.substring(1)); + } + } if(EMILootAgnos.isModLoaded(loot.id.getNamespace())) { String modName = EMILootAgnos.getModName(loot.id.getNamespace()); - rawTitle = LText.translatable("emi_loot.chest.unknown_chest", modName); + rawTitle = LText.translatable("emi_loot.chest.unknown_chest", chestName.toString() + modName); } else { Text unknown = LText.translatable("emi_loot.chest.unknown"); - rawTitle = LText.translatable("emi_loot.chest.unknown_chest", unknown.getString()); + rawTitle = LText.translatable("emi_loot.chest.unknown_chest", chestName.toString() + unknown.getString()); } if (EMILoot.config.isLogI18n(EMILoot.Type.CHEST)) { EMILoot.LOGGER.warn("Untranslated chest loot table \"" + loot.id + "\" (key: \"" + key + "\")"); diff --git a/xplat/src/main/java/fzzyhmstrs/emi_loot/emi/GameplayLootRecipe.java b/xplat/src/main/java/fzzyhmstrs/emi_loot/emi/GameplayLootRecipe.java index 207f6a3b..3021d73a 100644 --- a/xplat/src/main/java/fzzyhmstrs/emi_loot/emi/GameplayLootRecipe.java +++ b/xplat/src/main/java/fzzyhmstrs/emi_loot/emi/GameplayLootRecipe.java @@ -50,12 +50,21 @@ public GameplayLootRecipe(ClientGameplayLootTable loot) { Text text = LText.translatable(key); Text rawTitle; if (!I18n.hasTranslation(key)) { + StringBuilder gameplayName = new StringBuilder(); + String[] chestPathTokens = loot.id.getPath().split("[/_]"); + for (String str : chestPathTokens) { + if (str.length() <= 1) { + gameplayName.append(" ").append(str); + } else { + gameplayName.append(" ").append(str.substring(0, 1).toUpperCase()).append(str.substring(1)); + } + } if(EMILootAgnos.isModLoaded(loot.id.getNamespace())) { String modName = EMILootAgnos.getModName(loot.id.getNamespace()); - rawTitle = LText.translatable("emi_loot.gameplay.unknown_gameplay", modName); + rawTitle = LText.translatable("emi_loot.gameplay.unknown_gameplay", gameplayName.toString() + modName); } else { Text unknown = LText.translatable("emi_loot.gameplay.unknown"); - rawTitle = LText.translatable("emi_loot.gameplay.unknown_gameplay", unknown.getString()); + rawTitle = LText.translatable("emi_loot.gameplay.unknown_gameplay", gameplayName.toString() + unknown.getString()); } if (EMILoot.config.isLogI18n(EMILoot.Type.GAMEPLAY)) { EMILoot.LOGGER.warn("Untranslated gameplay loot table \"" + loot.id + "\" (key: \"" + key + "\")");