Class SpawnClusterSizeEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.LivingEvent
net.neoforged.neoforge.event.entity.living.SpawnClusterSizeEvent
This event is fired from
NaturalSpawner.spawnCategoryForPosition(net.minecraft.world.entity.MobCategory, net.minecraft.server.level.ServerLevel, net.minecraft.core.BlockPos)
when the spawning
system determines the maximum amount of the selected entity that can spawn at the same time.-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingVisibilityEvent
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
size
private int size
-
-
Constructor Details
-
SpawnClusterSizeEvent
public SpawnClusterSizeEvent(net.minecraft.world.entity.Mob entity)
-
-
Method Details
-
getSize
public int getSize()Gets the possibly event-modified max spawn cluster size for the entity.To see the default size, use
Mob.getMaxSpawnClusterSize()
- Returns:
- The max spawn cluster size
-
setSize
public void setSize(int size) Changes the max cluster size for the entity.- Parameters:
size
- The new size
-
getEntity
public net.minecraft.world.entity.Mob getEntity()- Overrides:
getEntity
in classLivingEvent
-