26 lines
800 B
Java
26 lines
800 B
Java
package net.minecraft.world.effect;
|
|
|
|
import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.world.entity.LivingEntity;
|
|
|
|
class AbsorptionMobEffect extends MobEffect {
|
|
protected AbsorptionMobEffect(MobEffectCategory mobEffectCategory, int i) {
|
|
super(mobEffectCategory, i);
|
|
}
|
|
|
|
@Override
|
|
public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity livingEntity, int i) {
|
|
return livingEntity.getAbsorptionAmount() > 0.0F;
|
|
}
|
|
|
|
@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)));
|
|
}
|
|
}
|