类 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
- 封闭类:
MobSpawnEvent
This event is fired when a mob checks for a valid spawn position, after
Conditions validated here include the following:
SpawnPlacements.checkSpawnRules(net.minecraft.world.entity.EntityType<T>, net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.entity.EntitySpawnReason, 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.
- API Note:
- This event fires after Spawn Placement checks, which are the primary set of spawn checks.
-
嵌套类概要
嵌套类从类继承的嵌套类/接口 net.neoforged.neoforge.event.entity.living.MobSpawnEvent
MobSpawnEvent.PositionCheck, MobSpawnEvent.SpawnPlacementCheck
从类继承的嵌套类/接口 net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
字段概要
字段 -
构造器概要
构造器构造器说明PositionCheck
(Mob mob, ServerLevelAccessor level, EntitySpawnReason spawnType, @Nullable BaseSpawner spawner) -
方法概要
修饰符和类型方法说明返回 the result of this event, which controls if the position check will succeed。@Nullable BaseSpawner
Retrieves the underlyingBaseSpawner
instance if this mob was created by a Mob Spawner of some form.Retrieves the type of mob spawn that is happening.void
Changes the result of this event.
-
字段详细资料
-
spawner
-
spawnType
-
result
-
-
构造器详细资料
-
PositionCheck
public PositionCheck(Mob mob, ServerLevelAccessor level, EntitySpawnReason spawnType, @Nullable @Nullable BaseSpawner spawner)
-
-
方法详细资料
-
getSpawner
Retrieves the underlyingBaseSpawner
instance if this mob was created by a Mob Spawner of some form. This is always null unlessgetSpawnType()
isEntitySpawnReason.SPAWNER
, and may still be null even then.- 返回:
- The BaseSpawner responsible for triggering the spawn, or null if none is available.
-
getSpawnType
Retrieves the type of mob spawn that is happening.- 返回:
- The mob spawn type.
- 另请参阅:
-
setResult
Changes the result of this event. -
getResult
返回 the result of this event, which controls if the position check will succeed。- 返回:
- the result of this event, which controls if the position check will succeed
-