Class MobSpawnEvent.PositionCheck

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.MobSpawnEvent
net.neoforged.neoforge.event.entity.living.MobSpawnEvent.PositionCheck
Enclosing class:
MobSpawnEvent

public static class MobSpawnEvent.PositionCheck extends MobSpawnEvent
This event is fired when a mob checks for a valid spawn position, after SpawnPlacements.checkSpawnRules(net.minecraft.world.entity.EntityType<T>, net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.entity.MobSpawnType, net.minecraft.core.BlockPos, net.minecraft.util.RandomSource) has been evaluated.
Conditions validated here include the following:
  • Obstruction - mobs inside blocks or fluids.
  • Pathfinding - if the spawn block is valid for pathfinding.
  • Sea Level - Ocelots check if the position is above sea level.
  • Spawn Block - Ocelots check if the below block is grass or leaves.

This event is only fired on the logical server.