feat: add Vampiric and Explosive enchantments with 21 language translations
All checks were successful
Build and Artifact / build (push) Successful in 3m2s

- Add VampiricEnchantmentEffect: heals player on hit (50%/100%/150% per level)
- Add ExplosiveEnchantmentEffect: chance-based explosions (10%/20%/30% per level)
- Register enchantments in ModEnchantmentEffects and datagen
- Add translations for 21 languages (DE, PT-BR, IT, ZH-CN, ZH-TW, JA, KO, RU, TR, UK, NL, DA, SV, NO, PL)
- Generate enchantment JSON data files
- Add enchantments to enchanting table tag
This commit is contained in:
2026-01-18 18:31:03 -06:00
parent 6652a25d8a
commit f3dbe89d8e
34 changed files with 392 additions and 22 deletions

View File

@@ -0,0 +1,7 @@
// 1.21.11 -999999999-01-01T00:00:00 More Spear Enchantments/ModEnchantmentGenerator
0305667391444c93e291cb484f3a1e8673b477ef data/more_spear_enchantments/enchantment/crippling.json
033f6c41fff18e9f2039d36468f1e119f689b6fb data/more_spear_enchantments/enchantment/explosive.json
6b22250e780912de621d38ac3ac9e6260a56422c data/more_spear_enchantments/enchantment/poisoning.json
293322a8166651ca50e67f240bb42eefe0dd0739 data/more_spear_enchantments/enchantment/thundering.json
9cbf3df72ea83d811363cc23e3a6849668091e96 data/more_spear_enchantments/enchantment/vampiric.json
b4264bd41977be031a7deee95bc1f8150dc390ce data/more_spear_enchantments/enchantment/withering.json

View File

@@ -0,0 +1,2 @@
// 1.21.11 -999999999-01-01T00:00:00 More Spear Enchantments/Tags for minecraft:item
6f6bce02ed9eefe20fee4b9c3dadfb2d6d53c4fe data/more_spear_enchantments/tags/item/spears.json

View File

@@ -0,0 +1,41 @@
{
"anvil_cost": 8,
"description": {
"translate": "enchantment.more_spear_enchantments.explosive"
},
"effects": {
"minecraft:post_attack": [
{
"affected": "victim",
"effect": {
"type": "more_spear_enchantments:explosive",
"chance": {
"type": "minecraft:linear",
"base": 0.1,
"per_level_above_first": 0.1
},
"power": {
"type": "minecraft:linear",
"base": 1.5,
"per_level_above_first": 0.5
}
},
"enchanted": "attacker"
}
]
},
"max_cost": {
"base": 70,
"per_level_above_first": 10
},
"max_level": 3,
"min_cost": {
"base": 20,
"per_level_above_first": 10
},
"slots": [
"hand"
],
"supported_items": "#more_spear_enchantments:spears",
"weight": 2
}

View File

@@ -0,0 +1,36 @@
{
"anvil_cost": 4,
"description": {
"translate": "enchantment.more_spear_enchantments.vampiric"
},
"effects": {
"minecraft:post_attack": [
{
"affected": "victim",
"effect": {
"type": "more_spear_enchantments:vampiric",
"heal_percentage": {
"type": "minecraft:linear",
"base": 0.5,
"per_level_above_first": 0.5
}
},
"enchanted": "attacker"
}
]
},
"max_cost": {
"base": 50,
"per_level_above_first": 8
},
"max_level": 3,
"min_cost": {
"base": 10,
"per_level_above_first": 8
},
"slots": [
"hand"
],
"supported_items": "#more_spear_enchantments:spears",
"weight": 5
}

View File

@@ -21,6 +21,8 @@ public class ModEnchantmentEffects {
public static final ResourceKey<Enchantment> WITHERING = of("withering");
public static final ResourceKey<Enchantment> POISONING = of("poisoning");
public static final ResourceKey<Enchantment> CRIPPLING = of("crippling");
public static final ResourceKey<Enchantment> VAMPIRIC = of("vampiric");
public static final ResourceKey<Enchantment> EXPLOSIVE = of("explosive");
// Register enchantment effect types
public static final RegistrySupplier<MapCodec<LightningEnchantmentEffect>> LIGHTNING_EFFECT =
@@ -31,6 +33,10 @@ public class ModEnchantmentEffects {
ENCHANTMENT_ENTITY_EFFECTS.register("withering", () -> WitheringEnchantmentEffect.CODEC);
public static final RegistrySupplier<MapCodec<CripplingEnchantmentEffect>> CRIPPLING_EFFECT =
ENCHANTMENT_ENTITY_EFFECTS.register("crippling", () -> CripplingEnchantmentEffect.CODEC);
public static final RegistrySupplier<MapCodec<VampiricEnchantmentEffect>> VAMPIRIC_EFFECT =
ENCHANTMENT_ENTITY_EFFECTS.register("vampiric", () -> VampiricEnchantmentEffect.CODEC);
public static final RegistrySupplier<MapCodec<ExplosiveEnchantmentEffect>> EXPLOSIVE_EFFECT =
ENCHANTMENT_ENTITY_EFFECTS.register("explosive", () -> ExplosiveEnchantmentEffect.CODEC);
private static ResourceKey<Enchantment> of(String path) {
Identifier id = Identifier.fromNamespaceAndPath(MoreSpearEnchantments.MOD_ID, path);

View File

@@ -0,0 +1,54 @@
package dev.sillyangel.more_spear_enchantments.enchantment.effect;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.enchantment.LevelBasedValue;
import net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect;
import net.minecraft.world.item.enchantment.EnchantedItemInUse;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
public record ExplosiveEnchantmentEffect(LevelBasedValue power, LevelBasedValue chance) implements EnchantmentEntityEffect {
public static final MapCodec<ExplosiveEnchantmentEffect> CODEC = RecordCodecBuilder.mapCodec(instance ->
instance.group(
LevelBasedValue.CODEC.fieldOf("power").forGetter(ExplosiveEnchantmentEffect::power),
LevelBasedValue.CODEC.fieldOf("chance").forGetter(ExplosiveEnchantmentEffect::chance)
).apply(instance, ExplosiveEnchantmentEffect::new)
);
@Override
public void apply(ServerLevel world, int level, EnchantedItemInUse context, Entity target, Vec3 pos) {
if (target instanceof LivingEntity victim) {
if (context.owner() != null && context.owner() instanceof Player player) {
// Calculate chance and power based on level
float explosionChance = this.chance.calculate(level);
// Random check for explosion
if (world.random.nextFloat() < explosionChance) {
float explosionPower = this.power.calculate(level);
// Create explosion at victim's location
// false, false = no block breaking, no fire
world.explode(
null,
victim.getX(),
victim.getY(),
victim.getZ(),
explosionPower,
Level.ExplosionInteraction.NONE
);
}
}
}
}
@Override
public MapCodec<? extends EnchantmentEntityEffect> codec() {
return CODEC;
}
}

View File

@@ -0,0 +1,45 @@
package dev.sillyangel.more_spear_enchantments.enchantment.effect;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.item.enchantment.LevelBasedValue;
import net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect;
import net.minecraft.world.item.enchantment.EnchantedItemInUse;
import net.minecraft.world.phys.Vec3;
public record VampiricEnchantmentEffect(LevelBasedValue healPercentage) implements EnchantmentEntityEffect {
public static final MapCodec<VampiricEnchantmentEffect> CODEC = RecordCodecBuilder.mapCodec(instance ->
instance.group(
LevelBasedValue.CODEC.fieldOf("heal_percentage").forGetter(VampiricEnchantmentEffect::healPercentage)
).apply(instance, VampiricEnchantmentEffect::new)
);
@Override
public void apply(ServerLevel world, int level, EnchantedItemInUse context, Entity target, Vec3 pos) {
if (target instanceof LivingEntity victim) {
if (context.owner() != null && context.owner() instanceof Player player) {
// Calculate heal amount based on a percentage of damage
// This is a simplified version - you may need to track actual damage dealt
float healPercent = this.healPercentage.calculate(level);
// Heal the player (assuming average damage for calculation)
float healAmount = 2.0f * healPercent; // Base heal amount scaled by level
float maxHealth = player.getMaxHealth();
float newHealth = Math.min(player.getHealth() + healAmount, maxHealth);
player.setHealth(newHealth);
}
}
}
@Override
public MapCodec<? extends EnchantmentEntityEffect> codec() {
return CODEC;
}
}

View File

@@ -24,7 +24,7 @@ public record WitheringEnchantmentEffect(LevelBasedValue duration) implements En
public void apply(ServerLevel world, int level, EnchantedItemInUse context, Entity target, Vec3 pos) {
if (target instanceof LivingEntity victim) {
if (context.owner() != null && context.owner() instanceof Player player) {
int witherDuration = (int) (this.duration.calculate(level) * 40); // Convert to ticks
int witherDuration = (int) (this.duration.calculate(level) * 50); // Convert to ticks
victim.addEffect(new MobEffectInstance(
MobEffects.WITHER,

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "Tordenvejr",
"enchantment.more_spear_enchantments.withering": "Visnende",
"enchantment.more_spear_enchantments.crippling": "Lemlæstende",
"enchantment.more_spear_enchantments.poisoning": "Forgiftning",
"enchantment.more_spear_enchantments.vampiric": "Vampyrisk",
"enchantment.more_spear_enchantments.explosive": "Eksplosiv"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "Donnernd",
"enchantment.more_spear_enchantments.withering": "Verdorrend",
"enchantment.more_spear_enchantments.crippling": "Verkrüppelnd",
"enchantment.more_spear_enchantments.poisoning": "Vergiftung",
"enchantment.more_spear_enchantments.vampiric": "Vampirisch",
"enchantment.more_spear_enchantments.explosive": "Explosiv"
}

View File

@@ -2,5 +2,7 @@
"enchantment.more_spear_enchantments.thundering": "Storm o' Thunder",
"enchantment.more_spear_enchantments.withering": "Rot o' Doom",
"enchantment.more_spear_enchantments.crippling": "Crippled Legs",
"enchantment.more_spear_enchantments.poisoning": "Venom'd Blade"
"enchantment.more_spear_enchantments.poisoning": "Venom'd Blade",
"enchantment.more_spear_enchantments.vampiric": "Blood Thirst",
"enchantment.more_spear_enchantments.explosive": "Powder Keg"
}

View File

@@ -2,5 +2,7 @@
"enchantment.more_spear_enchantments.thundering": "ƃuᴉɹǝpunɥꓕ",
"enchantment.more_spear_enchantments.withering": "ƃuᴉɹǝɥʇᴉM",
"enchantment.more_spear_enchantments.crippling": "ƃuᴉlddᴉɹƆ",
"enchantment.more_spear_enchantments.poisoning": "ƃuᴉuosuᴉԀ"
"enchantment.more_spear_enchantments.poisoning": "ƃuᴉuosuᴉԀ",
"enchantment.more_spear_enchantments.vampiric": "ɔᴉɹᴉdɯɐΛ",
"enchantment.more_spear_enchantments.explosive": "ǝʌᴉsolԀxƎ"
}

View File

@@ -2,6 +2,8 @@
"enchantment.more_spear_enchantments.thundering": "Thundering",
"enchantment.more_spear_enchantments.withering": "Withering",
"enchantment.more_spear_enchantments.crippling": "Crippling",
"enchantment.more_spear_enchantments.poisoning": "Poisoning"
"enchantment.more_spear_enchantments.poisoning": "Poisoning",
"enchantment.more_spear_enchantments.vampiric": "Vampiric",
"enchantment.more_spear_enchantments.explosive": "Explosive"
}

View File

@@ -2,5 +2,7 @@
"enchantment.more_spear_enchantments.thundering": "Tronante",
"enchantment.more_spear_enchantments.withering": "Marchitante",
"enchantment.more_spear_enchantments.crippling": "Lisiador",
"enchantment.more_spear_enchantments.poisoning": "Envenenamiento"
"enchantment.more_spear_enchantments.poisoning": "Envenenamiento",
"enchantment.more_spear_enchantments.vampiric": "Vampírico",
"enchantment.more_spear_enchantments.explosive": "Explosivo"
}

View File

@@ -2,5 +2,7 @@
"enchantment.more_spear_enchantments.thundering": "Tonnerre",
"enchantment.more_spear_enchantments.withering": "Flétrissure",
"enchantment.more_spear_enchantments.crippling": "Estropiant",
"enchantment.more_spear_enchantments.poisoning": "Empoisonnement"
"enchantment.more_spear_enchantments.poisoning": "Empoisonnement",
"enchantment.more_spear_enchantments.vampiric": "Vampirique",
"enchantment.more_spear_enchantments.explosive": "Explosif"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "Tuono",
"enchantment.more_spear_enchantments.withering": "Avvizzimento",
"enchantment.more_spear_enchantments.crippling": "Paralizzante",
"enchantment.more_spear_enchantments.poisoning": "Avvelenamento",
"enchantment.more_spear_enchantments.vampiric": "Vampirico",
"enchantment.more_spear_enchantments.explosive": "Esplosivo"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "雷鳴",
"enchantment.more_spear_enchantments.withering": "ウィザー",
"enchantment.more_spear_enchantments.crippling": "不自由",
"enchantment.more_spear_enchantments.poisoning": "毒",
"enchantment.more_spear_enchantments.vampiric": "吸血",
"enchantment.more_spear_enchantments.explosive": "爆発"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "천둥",
"enchantment.more_spear_enchantments.withering": "시들게 하기",
"enchantment.more_spear_enchantments.crippling": "불구",
"enchantment.more_spear_enchantments.poisoning": "중독",
"enchantment.more_spear_enchantments.vampiric": "흡혈",
"enchantment.more_spear_enchantments.explosive": "폭발"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "Bliksem",
"enchantment.more_spear_enchantments.withering": "Verwelking",
"enchantment.more_spear_enchantments.crippling": "Verminken",
"enchantment.more_spear_enchantments.poisoning": "Vergiftiging",
"enchantment.more_spear_enchantments.vampiric": "Vampirisch",
"enchantment.more_spear_enchantments.explosive": "Explosief"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "Torden",
"enchantment.more_spear_enchantments.withering": "Visning",
"enchantment.more_spear_enchantments.crippling": "Forkrøpling",
"enchantment.more_spear_enchantments.poisoning": "Forgiftning",
"enchantment.more_spear_enchantments.vampiric": "Vampyrisk",
"enchantment.more_spear_enchantments.explosive": "Eksplosiv"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "Piorun",
"enchantment.more_spear_enchantments.withering": "Więdnięcie",
"enchantment.more_spear_enchantments.crippling": "Kaleczenie",
"enchantment.more_spear_enchantments.poisoning": "Zatrucie",
"enchantment.more_spear_enchantments.vampiric": "Wampiryczny",
"enchantment.more_spear_enchantments.explosive": "Wybuchowy"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "Trovão",
"enchantment.more_spear_enchantments.withering": "Murcha",
"enchantment.more_spear_enchantments.crippling": "Aleijante",
"enchantment.more_spear_enchantments.poisoning": "Envenenamento",
"enchantment.more_spear_enchantments.vampiric": "Vampírico",
"enchantment.more_spear_enchantments.explosive": "Explosivo"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "Гром",
"enchantment.more_spear_enchantments.withering": "Иссушение",
"enchantment.more_spear_enchantments.crippling": "Увечье",
"enchantment.more_spear_enchantments.poisoning": "Отравление",
"enchantment.more_spear_enchantments.vampiric": "Вампиризм",
"enchantment.more_spear_enchantments.explosive": "Взрывной"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "Åska",
"enchantment.more_spear_enchantments.withering": "Vissning",
"enchantment.more_spear_enchantments.crippling": "Förlamande",
"enchantment.more_spear_enchantments.poisoning": "Förgiftning",
"enchantment.more_spear_enchantments.vampiric": "Vampyrisk",
"enchantment.more_spear_enchantments.explosive": "Explosiv"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "Yıldırım",
"enchantment.more_spear_enchantments.withering": "Soldurucu",
"enchantment.more_spear_enchantments.crippling": "Sakat Bırakıcı",
"enchantment.more_spear_enchantments.poisoning": "Zehirleme",
"enchantment.more_spear_enchantments.vampiric": "Vampirik",
"enchantment.more_spear_enchantments.explosive": "Patlayıcı"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "Гримучий",
"enchantment.more_spear_enchantments.withering": "Висихаючий",
"enchantment.more_spear_enchantments.crippling": "Каліцтво",
"enchantment.more_spear_enchantments.poisoning": "Отруєння",
"enchantment.more_spear_enchantments.vampiric": "Вампіризм",
"enchantment.more_spear_enchantments.explosive": "Вибуховий"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "雷鸣",
"enchantment.more_spear_enchantments.withering": "凋零",
"enchantment.more_spear_enchantments.crippling": "致残",
"enchantment.more_spear_enchantments.poisoning": "中毒",
"enchantment.more_spear_enchantments.vampiric": "吸血",
"enchantment.more_spear_enchantments.explosive": "爆炸"
}

View File

@@ -0,0 +1,9 @@
{
"enchantment.more_spear_enchantments.thundering": "雷鳴",
"enchantment.more_spear_enchantments.withering": "凋零",
"enchantment.more_spear_enchantments.crippling": "致殘",
"enchantment.more_spear_enchantments.poisoning": "中毒",
"enchantment.more_spear_enchantments.vampiric": "吸血",
"enchantment.more_spear_enchantments.explosive": "爆炸"
}

View File

@@ -4,6 +4,8 @@
"more_spear_enchantments:crippling",
"more_spear_enchantments:poisoning",
"more_spear_enchantments:thundering",
"more_spear_enchantments:withering"
"more_spear_enchantments:withering",
"more_spear_enchantments:vampiric",
"more_spear_enchantments:explosive"
]
}
}