1.1.0, level of enchantment is equal to level of the effects
All checks were successful
Build and Artifact / build (push) Successful in 2m13s

This commit is contained in:
2026-01-17 15:36:35 -06:00
parent 0898d5e374
commit c01c91841d
4 changed files with 6 additions and 10 deletions

View File

@@ -26,19 +26,17 @@ public record CripplingEnchantmentEffect(LevelBasedValue duration) implements En
if (target instanceof LivingEntity victim) { if (target instanceof LivingEntity victim) {
if (context.owner() != null && context.owner() instanceof Player player) { if (context.owner() != null && context.owner() instanceof Player player) {
int Duration = (int) (this.duration.calculate(level) * 50); // Convert to ticks int Duration = (int) (this.duration.calculate(level) * 50); // Convert to ticks
int slownessAmplifier = level - 1; // Level 1 = Slowness 0, Level 2 = Slowness I, Level 3 = Slowness II
int weaknessAmplifier = level - 1; // Level 1 = Weakness 0, Level 2 = Weakness I, Level 3 = Weakness II
victim.addEffect(new MobEffectInstance( victim.addEffect(new MobEffectInstance(
MobEffects.SLOWNESS, MobEffects.SLOWNESS,
Duration, Duration,
slownessAmplifier, level,
false, false,
true true
)); ));
victim.addEffect(new MobEffectInstance( victim.addEffect(new MobEffectInstance(
MobEffects.WEAKNESS, MobEffects.WEAKNESS,
Duration, Duration,
weaknessAmplifier, level,
false, false,
true true
)); ));

View File

@@ -24,13 +24,12 @@ public record PoisonEnchantmentEffect(LevelBasedValue duration) implements Encha
public void apply(ServerLevel world, int level, EnchantedItemInUse context, Entity target, Vec3 pos) { public void apply(ServerLevel world, int level, EnchantedItemInUse context, Entity target, Vec3 pos) {
if (target instanceof LivingEntity victim) { if (target instanceof LivingEntity victim) {
if (context.owner() != null && context.owner() instanceof Player player) { if (context.owner() != null && context.owner() instanceof Player player) {
int poisonDuration = (int) (this.duration.calculate(level) * 40); // Convert to ticks int poisonDuration = (int) (this.duration.calculate(level) * 50); // Convert to ticks
int poisonAmplifier = level - 2; // Level 1 = Poison 0, Level 2 = Poison I, Level 3 = Poison II
victim.addEffect(new MobEffectInstance( victim.addEffect(new MobEffectInstance(
MobEffects.POISON, MobEffects.POISON,
poisonDuration, poisonDuration,
poisonAmplifier, level,
false, false,
true true
)); ));

View File

@@ -25,12 +25,11 @@ public record WitheringEnchantmentEffect(LevelBasedValue duration) implements En
if (target instanceof LivingEntity victim) { if (target instanceof LivingEntity victim) {
if (context.owner() != null && context.owner() instanceof Player player) { 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) * 40); // Convert to ticks
int witherAmplifier = level - 2; // Level 1 = Wither 0, Level 2 = Wither I, Level 3 = Wither II
victim.addEffect(new MobEffectInstance( victim.addEffect(new MobEffectInstance(
MobEffects.WITHER, MobEffects.WITHER,
witherDuration, witherDuration,
witherAmplifier, level,
false, false,
true true
)); ));

View File

@@ -1,7 +1,7 @@
{ {
"homepage": "https://modrinth.com/mod/more-spear-enchantments", "homepage": "https://modrinth.com/mod/more-spear-enchantments",
"1.21.11": { "1.21.11": {
"1.1.0": "added to enchantment table (wow angel how did you forget, that is literally the whole point of the mod )\n, and switch to mojang mapping from yarn" "1.1.0": "added to enchantment table (wow angel how did you forget, that is literally the whole point of the mod )\n, and switch to mojang mapping from yarn\n and the level of the book matches with the level of the effect, and each lvl duration is calculated by (level * 50) with 50 being ticks "
}, },
"promos": { "promos": {
"1.21.11-latest": "1.1.0", "1.21.11-latest": "1.1.0",