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 (context.owner() != null && context.owner() instanceof Player player) {
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(
MobEffects.SLOWNESS,
Duration,
slownessAmplifier,
level,
false,
true
));
victim.addEffect(new MobEffectInstance(
MobEffects.WEAKNESS,
Duration,
weaknessAmplifier,
level,
false,
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) {
if (target instanceof LivingEntity victim) {
if (context.owner() != null && context.owner() instanceof Player player) {
int poisonDuration = (int) (this.duration.calculate(level) * 40); // Convert to ticks
int poisonAmplifier = level - 2; // Level 1 = Poison 0, Level 2 = Poison I, Level 3 = Poison II
int poisonDuration = (int) (this.duration.calculate(level) * 50); // Convert to ticks
victim.addEffect(new MobEffectInstance(
MobEffects.POISON,
poisonDuration,
poisonAmplifier,
level,
false,
true
));

View File

@@ -25,12 +25,11 @@ public record WitheringEnchantmentEffect(LevelBasedValue duration) implements En
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 witherAmplifier = level - 2; // Level 1 = Wither 0, Level 2 = Wither I, Level 3 = Wither II
victim.addEffect(new MobEffectInstance(
MobEffects.WITHER,
witherDuration,
witherAmplifier,
level,
false,
true
));