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 a7ac31b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ 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) {

Check failure on line 210 in fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java

View workflow job for this annotation

GitHub Actions / build (21-ubuntu)

non-tab indentation
add(translatableTextContent.getKey(), value);

Check failure on line 211 in fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java

View workflow job for this annotation

GitHub Actions / build (21-ubuntu)

non-tab indentation
} else { // fallback to Util.createTranslationKey formatting (should it error instead?)

Check failure on line 212 in fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java

View workflow job for this annotation

GitHub Actions / build (21-ubuntu)

non-tab indentation
add(Util.createTranslationKey("stat_type", Registries.STAT_TYPE.getId(statType)), value);

Check failure on line 213 in fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricLanguageProvider.java

View workflow job for this annotation

GitHub Actions / build (21-ubuntu)

non-tab indentation
}
}

/**
Expand Down

0 comments on commit a7ac31b

Please sign in to comment.