26 lines
		
	
	
	
		
			766 B
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
	
		
			766 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 level, LivingEntity entity, int amplifier) {
 | |
| 		return entity.getAbsorptionAmount() > 0.0F;
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) {
 | |
| 		return true;
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public void onEffectStarted(LivingEntity entity, int amplifier) {
 | |
| 		super.onEffectStarted(entity, amplifier);
 | |
| 		entity.setAbsorptionAmount(Math.max(entity.getAbsorptionAmount(), 4 * (1 + amplifier)));
 | |
| 	}
 | |
| }
 |