25 lines
700 B
Java
25 lines
700 B
Java
package net.minecraft.world.effect;
|
|
|
|
import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.world.entity.LivingEntity;
|
|
|
|
class PoisonMobEffect extends MobEffect {
|
|
protected PoisonMobEffect(MobEffectCategory mobEffectCategory, int i) {
|
|
super(mobEffectCategory, i);
|
|
}
|
|
|
|
@Override
|
|
public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) {
|
|
if (livingEntity.getHealth() > 1.0F) {
|
|
livingEntity.hurtServer(serverLevel, livingEntity.damageSources().magic(), 1.0F);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) {
|
|
int i = 25 >> amplifier;
|
|
return i > 0 ? duration % i == 0 : true;
|
|
}
|
|
}
|