WindChargedMobEffect .java

net.minecraft.world.effect.WindChargedMobEffect (class): members: onMobRemoved. imports: AbstractWindCharge, WeightedList, ParticleTypes, SoundEvents.

net.minecraft.world.effectclass42 linescommonextends MobEffect1.3 KB

API Surface (1)

void onMobRemoved(final ServerLevel level, final LivingEntity mob, final int amplifier, final Entity.RemovalReason reason)

Full Source

WindChargedMobEffect.java42 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.effect;
2
3
import net.minecraft.core.particles.ParticleTypes;
4
import net.minecraft.server.level.ServerLevel;
5
import net.minecraft.sounds.SoundEvents;
6
import net.minecraft.util.random.WeightedList;
7
import net.minecraft.world.entity.Entity;
8
import net.minecraft.world.entity.LivingEntity;
9
import net.minecraft.world.entity.projectile.hurtingprojectile.windcharge.AbstractWindCharge;
10
import net.minecraft.world.level.Level;
11
12
class WindChargedMobEffect extends MobEffect {
13
	protected WindChargedMobEffect(final MobEffectCategory category, final int color) {
14
		super(category, color, ParticleTypes.SMALL_GUST);
15
	}
16
17
	@Override
18
	public void onMobRemoved(final ServerLevel level, final LivingEntity mob, final int amplifier, final Entity.RemovalReason reason) {
19
		if (reason == Entity.RemovalReason.KILLED) {
20
			double x = mob.getX();
21
			double y = mob.getY() + mob.getBbHeight() / 2.0F;
22
			double z = mob.getZ();
23
			float gustStrength = 3.0F + mob.getRandom().nextFloat() * 2.0F;
24
			level.explode(
25
				mob,
26
				null,
27
				AbstractWindCharge.EXPLOSION_DAMAGE_CALCULATOR,
28
				x,
29
				y,
30
				z,
31
				gustStrength,
32
				false,
33
				Level.ExplosionInteraction.TRIGGER,
34
				ParticleTypes.GUST_EMITTER_SMALL,
35
				ParticleTypes.GUST_EMITTER_LARGE,
36
				WeightedList.of(),
37
				SoundEvents.BREEZE_WIND_CHARGE_BURST
38
			);
39
		}
40
	}
41
}
42

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