From 60c45c18ddfca186c7414449a4da1139fb921da5 Mon Sep 17 00:00:00 2001 From: solonovamax Date: Sat, 5 Oct 2024 18:17:59 -0400 Subject: [PATCH] Use translation key from name element, with fallback to Util.createTranslationKey formatting for StatType --- .../api/datagen/v1/provider/FabricLanguageProvider.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java index 30d896f57c..8522d02037 100644 --- a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java +++ b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java @@ -207,7 +207,12 @@ default void add(RegistryEntry 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); + } } /**