Change implementation of MaterialPart::getLocalizedName, so that it checks whether the material name is translatable first, and if so, use the translation, otherwise, fallback to Material::getName.
Change implementation of ItemMaterialArmor::getItemStackDisplayName in a similar way to that of what 1. describes.
Change implementation of Material::getUnlocalizedName, to include base.material. prefix. Add Material::getTranslationKey for translatability check in 1. and 2.; it also functions as a pure accessor of translation key of Material.
As mentioned in The-Acronym-Coders/ContentTweaker#106, I18n.canTranslate is not an expensive call, and translated name is only required in places like item tooltip and HUD, so there is no performance issue in this solution.
This commit does the following:
MaterialPart::getLocalizedName
, so that it checks whether the material name is translatable first, and if so, use the translation, otherwise, fallback toMaterial::getName
.ItemMaterialArmor::getItemStackDisplayName
in a similar way to that of what 1. describes.Change implementation ofAddMaterial::getUnlocalizedName
, to includebase.material.
prefix.Material::getTranslationKey
for translatability check in 1. and 2.; it also functions as a pure accessor of translation key ofMaterial
.As mentioned in The-Acronym-Coders/ContentTweaker#106,
I18n.canTranslate
is not an expensive call, and translated name is only required in places like item tooltip and HUD, so there is no performance issue in this solution.