Class LanguageProvider
java.lang.Object
net.ixdarklord.coolcatcore.api.datagen.language.LanguageProvider
A platform-agnostic, extensible language provider inspired by Fabric’s
TranslationBuilder. Used to define and collect all language
entries for data generation on both Forge and Fabric.
Extend this class and implement addTranslations() to register
translation keys. Platform-specific wrappers (Forge or Fabric) will
automatically call this method during datagen.
Example Usage:
public class MyModLanguageProvider extends LanguageProvider {
@Override
public void addTranslations() {
add("itemGroup.my_mod_tab", "My Mod Items");
add(MyModItems.MAGIC_WAND.get(), "Magic Wand");
add(MyModEffects.MANA_BOOST.get(), "Mana Boost");
}
}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a direct translation entry.voidMerges an existing language JSON file into this provider.voidAdds a translation for aKeyMapping.voidadd(net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> entityAttribute, String value) Adds a translation for anAttribute.voidadd(net.minecraft.resources.ResourceKey<net.minecraft.world.item.CreativeModeTab> key, String value) Adds a translation for aCreativeModeTab.voidAdds a translation for aResourceLocation.voidAdds a translation for aStatType.voidAdds a translation for aMobEffect.voidAdds a translation for anEntityType.voidAdds translation entries for aPotion.voidAdds a translation for anItem.voidAdds a Curios slot translation.voidaddEnchantment(net.minecraft.resources.ResourceKey<net.minecraft.world.item.enchantment.Enchantment> enchantment, String value) Adds a translation for anEnchantment.voidAdds translation entries for aPotionwith a specific type suffix.abstract voidvoidaddTrinkets(String key, String value) Adds a Trinkets slot translation.Returns all collected translations as an unmodifiable map.
-
Constructor Details
-
LanguageProvider
public LanguageProvider()
-
-
Method Details
-
addTranslations
public abstract void addTranslations() -
add
Adds a direct translation entry. -
add
Adds a translation for anItem. -
add
Adds a translation for aMobEffect. -
add
Adds a translation for aKeyMapping. -
addEnchantment
public void addEnchantment(net.minecraft.resources.ResourceKey<net.minecraft.world.item.enchantment.Enchantment> enchantment, String value) Adds a translation for anEnchantment. -
add
public void add(net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> entityAttribute, String value) Adds a translation for anAttribute. -
add
Adds a translation for anEntityType. -
add
Adds a translation for aStatType. -
add
Adds a translation for aResourceLocation. -
add
public void add(net.minecraft.resources.ResourceKey<net.minecraft.world.item.CreativeModeTab> key, String value) Adds a translation for aCreativeModeTab. -
add
Adds translation entries for aPotion. -
addPotion
public void addPotion(net.minecraft.world.item.alchemy.Potion potion, String baseName, @Nullable @Nullable String type) Adds translation entries for aPotionwith a specific type suffix. -
addCurios
Adds a Curios slot translation. -
addTrinkets
Adds a Trinkets slot translation. -
add
Merges an existing language JSON file into this provider.- Parameters:
path- The path to the JSON language file.- Throws:
IOException- If the file cannot be read.
-
getTranslations
Returns all collected translations as an unmodifiable map.
-