Class SpawnClusterSizeEvent

java.lang.Object
net.neoforged.bus.api.Event

public class SpawnClusterSizeEvent extends LivingEvent
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.
  • 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 class LivingEvent