Skip to content

Commit a7ac31b

Browse files
committed
Use translation key from name element, with fallback to Util.createTranslationKey formatting for StatType
1 parent 3b9245a commit a7ac31b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ default void add(RegistryEntry<EntityAttribute> entityAttribute, String value) {
207207
* @param value The value of the entry.
208208
*/
209209
default void add(StatType<?> statType, String value) {
210-
add("stat_type." + Registries.STAT_TYPE.getId(statType).toString().replace(':', '.'), value);
210+
if (statType.getName() instanceof TranslatableTextContent translatableTextContent) {
211+
add(translatableTextContent.getKey(), value);
212+
} else { // fallback to Util.createTranslationKey formatting (should it error instead?)
213+
add(Util.createTranslationKey("stat_type", Registries.STAT_TYPE.getId(statType)), value);
214+
}
211215
}
212216

213217
/**

0 commit comments

Comments
 (0)