Skip to content

Commit 60c45c1

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

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,12 @@ 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+
return;
213+
} else { // fallback to Util.createTranslationKey formatting (should it error instead?)
214+
add(Util.createTranslationKey("stat_type", Registries.STAT_TYPE.getId(statType)), value);
215+
}
211216
}
212217

213218
/**

0 commit comments

Comments
 (0)