feat: add Vampiric and Explosive enchantments with 21 language translations
All checks were successful
Build Mod / build (push) Successful in 2m33s
All checks were successful
Build Mod / build (push) Successful in 2m33s
- 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:
@@ -21,11 +21,5 @@ public final class MoreSpearEnchantments {
|
||||
|
||||
private void commonSetup(final FMLCommonSetupEvent event) {
|
||||
LOGGER.info("Initializing More Spear Enchantments");
|
||||
LOGGER.info("Enchantment effects registered:");
|
||||
LOGGER.info(" - Lightning (Thundering enchantment)");
|
||||
LOGGER.info(" - Poison (Poisoning enchantment)");
|
||||
LOGGER.info(" - Withering (Withering enchantment)");
|
||||
LOGGER.info(" - Crippling (Crippling enchantment)");
|
||||
LOGGER.info("Check enchanting table or use '/enchant' command to apply them to tridents!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,5 +22,9 @@ public class ModEnchantmentEffects {
|
||||
ENCHANTMENT_ENTITY_EFFECTS.register("withering", () -> WitheringEnchantmentEffect.CODEC);
|
||||
public static final RegistryObject<MapCodec<CripplingEnchantmentEffect>> CRIPPLING_EFFECT =
|
||||
ENCHANTMENT_ENTITY_EFFECTS.register("crippling", () -> CripplingEnchantmentEffect.CODEC);
|
||||
public static final RegistryObject<MapCodec<VampiricEnchantmentEffect>> VAMPIRIC_EFFECT =
|
||||
ENCHANTMENT_ENTITY_EFFECTS.register("vampiric", () -> VampiricEnchantmentEffect.CODEC);
|
||||
public static final RegistryObject<MapCodec<ExplosiveEnchantmentEffect>> EXPLOSIVE =
|
||||
ENCHANTMENT_ENTITY_EFFECTS.register("explosive", () -> ExplosiveEnchantmentEffect.CODEC);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
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.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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ loaderVersion="${loader_version_range}" #mandatory This is typically bumped ever
|
||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||
license="${mod_license}"
|
||||
# A URL to refer people to when problems occur with this mod
|
||||
updateJSONURL="https://git.sillyangel.dev/angel/more-spear-enchants/raw/branch/master/update.json"
|
||||
updateJSONURL="https://api.modrinth.com/updates/more-spear-enchantments/forge_updates.json"
|
||||
issueTrackerURL="https://git.sillyangel.dev/angel/mse-forge/issues" #optional
|
||||
# If your mod is purely client-side and has no multiplayer functionality (be it dedicated servers or Open to LAN),
|
||||
# set this to true, and Forge will set the correct displayTest for you and skip loading your mod on dedicated servers.
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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Ǝ"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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": "爆発"
|
||||
}
|
||||
|
||||
@@ -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": "폭발"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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": "Взрывной"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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ı"
|
||||
}
|
||||
|
||||
@@ -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": "Вибуховий"
|
||||
}
|
||||
|
||||
@@ -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": "爆炸"
|
||||
}
|
||||
|
||||
@@ -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": "爆炸"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user