Skip to content

Commit

Permalink
Use translation key from name element, with fallback to Util.createTr…
Browse files Browse the repository at this point in the history
…anslationKey formatting for StatType
  • Loading branch information
solonovamax committed Oct 5, 2024
1 parent 3b9245a commit 60c45c1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ default void add(RegistryEntry<EntityAttribute> entityAttribute, String value) {
* @param value The value of the entry.
*/
default void add(StatType<?> statType, String value) {
add("stat_type." + Registries.STAT_TYPE.getId(statType).toString().replace(':', '.'), value);
if (statType.getName() instanceof TranslatableTextContent translatableTextContent) {
add(translatableTextContent.getKey(), value);
return;
} else { // fallback to Util.createTranslationKey formatting (should it error instead?)
add(Util.createTranslationKey("stat_type", Registries.STAT_TYPE.getId(statType)), value);
}
}

/**
Expand Down

0 comments on commit 60c45c1

Please sign in to comment.