PoisonMobEffect .java

net.minecraft.world.effect.PoisonMobEffect (class): members: DAMAGE_INTERVAL, shouldApplyEffectTickThisTick, applyEffectTick. imports: LivingEntity.

net.minecraft.world.effectclass28 linescommonextends MobEffect782 B

API Surface (2)

boolean applyEffectTick(final ServerLevel level, final LivingEntity mob, final int amplification)
boolean shouldApplyEffectTickThisTick(final int tickCount, final int amplification)

Fields & Constants (1)

DAMAGE_INTERVAL

Code Graph: Dependencies (4)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

PoisonMobEffect.java28 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.effect;
2
3
import net.minecraft.server.level.ServerLevel;
4
import net.minecraft.world.entity.LivingEntity;
5
6
public class PoisonMobEffect extends MobEffect {
7
	public static final int DAMAGE_INTERVAL = 25;
8
9
	protected PoisonMobEffect(final MobEffectCategory category, final int color) {
10
		super(category, color);
11
	}
12
13
	@Override
14
	public boolean applyEffectTick(final ServerLevel level, final LivingEntity mob, final int amplification) {
15
		if (mob.getHealth() > 1.0F) {
16
			mob.hurtServer(level, mob.damageSources().magic(), 1.0F);
17
		}
18
19
		return true;
20
	}
21
22
	@Override
23
	public boolean shouldApplyEffectTickThisTick(final int tickCount, final int amplification) {
24
		int interval = 25 >> amplification;
25
		return interval > 0 ? tickCount % interval == 0 : true;
26
	}
27
}
28

Decompiled Minecraft 26.3 source of PoisonMobEffect (net/minecraft/world/effect/PoisonMobEffect.java) with Mojang official mappings, stored verbatim on the site.