Skip to content

Commit

Permalink
Add enchantment descriptions compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
Provismet committed Jan 4, 2024
1 parent beac772 commit 4d23a12
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/main/generated/assets/additional-armoury/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
"death.attack.fireball_spell.item": "%1$s was blasted by %2$s using %3$s",
"death.attack.frostball_spell": "%1$s was frozen by %2$s",
"death.attack.frostball_spell.item": "%1$s was frozen by %2$s using %3$s",
"effect.additional-armoury.shattered": "Shattered",
"enchantment.additional-armoury.boost": "Boosting",
"enchantment.additional-armoury.boost.desc": "Launches the user forwards.",
"enchantment.additional-armoury.eruption": "Eruption",
"enchantment.additional-armoury.eruption.desc": "Knockbacks all nearby enemies.",
"enchantment.additional-armoury.fireball": "Fireball",
"enchantment.additional-armoury.fireball.desc": "Shoot a fireball that burns on hit.",
"enchantment.additional-armoury.frostball": "Frostball",
"enchantment.additional-armoury.frostball.desc": "Shoot a frostball that freezes on hit.",
"enchantment.additional-armoury.jump": "Soaring",
"enchantment.additional-armoury.jump.desc": "Launch into the air and gain slow-fall.",
"entity.additional-armoury.fireball_spell": "Fireball Spell",
"entity.additional-armoury.frostball_spell": "Frostball Spell",
"item.additional-armoury.diamond_dagger": "Diamond Dagger",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
import com.provismet.AdditionalArmoury.registries.AAEnchantments;
import com.provismet.AdditionalArmoury.registries.AAEntityTypes;
import com.provismet.AdditionalArmoury.registries.AAItems;
import com.provismet.AdditionalArmoury.registries.AAStatusEffects;

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionUtil;
import net.minecraft.potion.Potions;
Expand Down Expand Up @@ -37,11 +39,13 @@ public void generateTranslations (TranslationBuilder translationBuilder) {
translationBuilder.add(AAEntityTypes.FIREBALL, "Fireball Spell");
translationBuilder.add(AAEntityTypes.FROSTBALL, "Frostball Spell");

translationBuilder.add(AAEnchantments.BOOST, "Boosting");
translationBuilder.add(AAEnchantments.ERUPTION, "Eruption");
translationBuilder.add(AAEnchantments.JUMP, "Soaring");
translationBuilder.add(AAEnchantments.FIREBALL, "Fireball");
translationBuilder.add(AAEnchantments.FROSTBALL, "Frostball");
translationBuilder.add(AAStatusEffects.SHATTERED, "Shattered");

LanguageGenerator.addEnchantment(translationBuilder, AAEnchantments.BOOST, "Boosting", "Launches the user forwards.");
LanguageGenerator.addEnchantment(translationBuilder, AAEnchantments.ERUPTION, "Eruption", "Knockbacks all nearby enemies.");
LanguageGenerator.addEnchantment(translationBuilder, AAEnchantments.JUMP, "Soaring", "Launch into the air and gain slow-fall.");
LanguageGenerator.addEnchantment(translationBuilder, AAEnchantments.FIREBALL, "Fireball", "Shoot a fireball that burns on hit.");
LanguageGenerator.addEnchantment(translationBuilder, AAEnchantments.FROSTBALL, "Frostball", "Shoot a frostball that freezes on hit.");

LanguageGenerator.addAttackDeathMessage(translationBuilder, "fireball_spell", "was blasted by");
LanguageGenerator.addAttackDeathMessage(translationBuilder, "frostball_spell", "was frozen by");
Expand Down Expand Up @@ -75,6 +79,11 @@ else if (potionEntry == Potions.WATER) {
}
}

private static void addEnchantment (TranslationBuilder translationBuilder, Enchantment enchantment, String name, String description) {
translationBuilder.add(enchantment, name);
translationBuilder.add(enchantment.getTranslationKey() + ".desc", description);
}

private static String titleCase (String string) {
String[] words = string.split(" ");
StringBuilder builder = new StringBuilder();
Expand Down

0 comments on commit 4d23a12

Please sign in to comment.