Class MobSpawnEvent.FinalizeSpawn

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.entity.EntityEvent
net.minecraftforge.event.entity.living.MobSpawnEvent
net.minecraftforge.event.entity.living.MobSpawnEvent.FinalizeSpawn
Enclosing class:
MobSpawnEvent

public static class MobSpawnEvent.FinalizeSpawn extends MobSpawnEvent
This event is fired before Mob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.MobSpawnType, net.minecraft.world.entity.SpawnGroupData, net.minecraft.nbt.CompoundTag) is called.
This allows mods to control mob initialization.
In vanilla code, this event is injected by a transformer and not via patch, so calls cannot be traced via call hierarchy (it is not source-visible).

Canceling this event will result in Mob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.MobSpawnType, net.minecraft.world.entity.SpawnGroupData, net.minecraft.nbt.CompoundTag) not being called, and the returned value always being null, instead of propagating the SpawnGroupData.
The entity will still be spawned. If you want to prevent the spawn, use setSpawnCancelled(boolean), which will cause Forge to prevent the spawn.

This event is fired on MinecraftForge.EVENT_BUS, and is only fired on the logical server.

See Also: