@Translation
overrides the default translations as defined in Translation. You can also define this annotation for an entire class, and then use @Translation
to negate the override on settings within that class that need the default translations.
This annotation will provide a name, description, and prefix translation for the entry depending on the lang provided. If lang isn't found, the default translation will be used.
This annotation is useful for "repeating units" of config. For example, a ValidatedAny
that is repeated, so the setting names are the same for each instance.
prefix
: Set the prefix of your lang key. The field name is appended to this prefix.my.prefix.[fieldName]
andmy.prefix.[fieldName].desc
negate
: Turns off class-wide Translation for a specific setting.
@Translation(prefix = "example.prefix") //every setting within this class, for every instance of the class, will use this lang prefixclass RepeatingUnit implements Walkable {public RepeatingUnit(){}public RepeatingUnit(int thing1, float thing2, TagKey<Item> thing3) {this.thing1 = thing1;this.thing2 = thing2;this.thing3.validateAndSet(thing3);}public boolean thing1 = true;@Translation(negate = true) //thing2 needs a custom lang per usage, depending on the specific use for it. Skips the prefix override.public float thing2 = 3f;public ValidatedTagKey<Item> thing3 = new ValidatedTagKey(ItemTags.TRIMMABLE_ARMOR);}// the lang for this will look like//"example.prefix.thing1": "Thing 1 Name"//"my_mod.my_config.unitName.thing2": "Custom Per-Instance Name"//"example.prefix.thing3": "Thing 3 Name"
Heads up!
See the documentation page here 🗗