类 MobSpawnEvent.SpawnPlacementCheck
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.living.MobSpawnEvent.SpawnPlacementCheck
- 封闭类:
MobSpawnEvent
public static class MobSpawnEvent.SpawnPlacementCheck
extends net.neoforged.bus.api.Event
This event is fired when Spawn Placements (aka Spawn Rules) are checked, before a mob attempts to spawn.
Spawn Placement checks include light levels, slime chunks, grass blocks for animals, and others in the same vein.
The purpose of this event is to permit runtime changes to any or all spawn placement logic without having to wrap the placement for each entity.
Spawn Placement checks include light levels, slime chunks, grass blocks for animals, and others in the same vein.
The purpose of this event is to permit runtime changes to any or all spawn placement logic without having to wrap the placement for each entity.
This event is only fired on the logical server.
This event is not fired for mob spawners which utilize SpawnData.CustomSpawnRules
, as they do not check spawn placements.
- 另请参阅:
- API Note:
- If your modifications are for a single entity, and do not vary at runtime, use
RegisterSpawnPlacementsEvent
.
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明private final boolean
private final EntityType
<?> private final ServerLevelAccessor
private final BlockPos
private final RandomSource
private final EntitySpawnReason
-
构造器概要
构造器构造器说明SpawnPlacementCheck
(EntityType<?> entityType, ServerLevelAccessor level, EntitySpawnReason spawnType, BlockPos pos, RandomSource random, boolean defaultResult) Internal. -
方法概要
修饰符和类型方法说明boolean
The default vanilla result is useful if an additional check wants to force引用无效
Result#ALLOW
EntityType
<?> getLevel()
boolean
返回 If the placement check will succeed or not, based on the current event result。getPos()
In all vanilla cases, this is equal toLevelAccessor.getRandom()
.返回 the result of this event, which controls if the placement check will succeed。Retrieves the type of mob spawn that is happening.void
Changes the result of this event.
-
字段详细资料
-
entityType
-
level
-
spawnType
-
pos
-
random
-
defaultResult
private final boolean defaultResult -
result
-
-
构造器详细资料
-
SpawnPlacementCheck
@Internal public SpawnPlacementCheck(EntityType<?> entityType, ServerLevelAccessor level, EntitySpawnReason spawnType, BlockPos pos, RandomSource random, boolean defaultResult) Internal.
-
-
方法详细资料
-
getEntityType
- 返回:
- The type of entity that checks are being performed for.
-
getLevel
- 返回:
- The level relating to the mob spawn action
-
getSpawnType
Retrieves the type of mob spawn that is happening.- 返回:
- The mob spawn type.
- 另请参阅:
-
getPos
- 返回:
- The position where checks are being evaluated.
-
getRandom
In all vanilla cases, this is equal toLevelAccessor.getRandom()
.- 返回:
- The random source being used.
-
getDefaultResult
public boolean getDefaultResult()The default vanilla result is useful if an additional check wants to force引用无效
Result#ALLOW
- 返回:
- The result of the vanilla spawn placement check.
-
setResult
Changes the result of this event. -
getResult
返回 the result of this event, which controls if the placement check will succeed。- 返回:
- the result of this event, which controls if the placement check will succeed
-
getPlacementCheckResult
public boolean getPlacementCheckResult()返回 If the placement check will succeed or not, based on the current event result。- 返回:
- If the placement check will succeed or not, based on the current event result
-