25 lines
773 B
Java
25 lines
773 B
Java
package net.minecraft.world.effect;
|
|
|
|
import net.minecraft.world.entity.LivingEntity;
|
|
|
|
class AbsorptionMobEffect extends MobEffect {
|
|
protected AbsorptionMobEffect(MobEffectCategory mobEffectCategory, int i) {
|
|
super(mobEffectCategory, i);
|
|
}
|
|
|
|
@Override
|
|
public boolean applyEffectTick(LivingEntity livingEntity, int amplifier) {
|
|
return livingEntity.getAbsorptionAmount() > 0.0F || livingEntity.level().isClientSide;
|
|
}
|
|
|
|
@Override
|
|
public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public void onEffectStarted(LivingEntity livingEntity, int amplifier) {
|
|
super.onEffectStarted(livingEntity, amplifier);
|
|
livingEntity.setAbsorptionAmount(Math.max(livingEntity.getAbsorptionAmount(), 4 * (1 + amplifier)));
|
|
}
|
|
}
|