24 lines
687 B
Java
24 lines
687 B
Java
package net.minecraft.world.effect;
|
|
|
|
import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.world.entity.LivingEntity;
|
|
|
|
public class WitherMobEffect extends MobEffect {
|
|
public static final int DAMAGE_INTERVAL = 40;
|
|
|
|
protected WitherMobEffect(MobEffectCategory mobEffectCategory, int i) {
|
|
super(mobEffectCategory, i);
|
|
}
|
|
|
|
@Override
|
|
public boolean applyEffectTick(ServerLevel level, LivingEntity entity, int amplifier) {
|
|
entity.hurtServer(level, entity.damageSources().wither(), 1.0F);
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) {
|
|
int i = 40 >> amplifier;
|
|
return i > 0 ? duration % i == 0 : true;
|
|
}
|
|
}
|