the enchantment level of the book matches with the effect
All checks were successful
Build Mod / build (push) Successful in 48s
All checks were successful
Build Mod / build (push) Successful in 48s
This commit is contained in:
@@ -24,20 +24,18 @@ public record CripplingEnchantmentEffect(LevelBasedValue duration) implements En
|
|||||||
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 Duration = (int) (this.duration.calculate(level) * 50); // Convert to ticks
|
int Duration = (int) (this.duration.calculate(level) * 40); // 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
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -25,12 +25,11 @@ public record PoisonEnchantmentEffect(LevelBasedValue duration) implements Encha
|
|||||||
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) * 40); // 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
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -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
|
||||||
));
|
));
|
||||||
|
|||||||
Reference in New Issue
Block a user