Class StructureSpawnListGatherEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.world.StructureSpawnListGatherEvent

public class StructureSpawnListGatherEvent extends net.minecraftforge.eventbus.api.Event
This event fires when a Structure is gathering what mobs/creatures can spawn in it. In order to maintain the most compatibility possible with other mods' modifications to a structure, the event should be assigned a EventPriority as follows: - Additions : EventPriority.HIGH - Removals : EventPriority.NORMAL - Any other modification : EventPriority.LOW Be aware that another mod could have done an operation beforehand, so an expected value out of a vanilla structure might not always be the same, depending on other mods.
  • Field Details

  • Constructor Details

    • StructureSpawnListGatherEvent

      public StructureSpawnListGatherEvent(Structure<?> structure)
  • Method Details

    • getStructure

      public Structure<?> getStructure()
      Returns:
      Structure to add or remove spawns to/from.
    • setInsideOnly

      public void setInsideOnly(boolean insideOnly)
      Change if entity spawn location checks are done against the entire bounds of the structure or only the inside the pieces of the structure.
      Parameters:
      insideOnly - true to restrict the spawn checks to inside the pieces of the structure, false to allow spawns outside
    • isInsideOnly

      public boolean isInsideOnly()
      Checks if spawns for the structure are restricted to being inside the individual pieces of the structure.
    • getEntitySpawns

      public List<MobSpawnInfo.Spawners> getEntitySpawns(EntityClassification classification)
      Gets an unmodifiable view of the the list representing the entity spawns for the given classification.
      Parameters:
      classification - Entity Classification
      Returns:
      The list of spawns for the given classification.
    • getOrCreateEntitySpawns

      private List<MobSpawnInfo.Spawners> getOrCreateEntitySpawns(EntityClassification classification)
      Gets the internal spawn list for a given entity classification, or adds one if needed. (This includes adding it to the unmodifiable view)
    • addEntitySpawn

      public void addEntitySpawn(EntityClassification classification, MobSpawnInfo.Spawners spawner)
      Adds a spawn to the list of spawns for the given classification.
      Parameters:
      classification - Entity Classification
      spawner - Spawner
    • addEntitySpawns

      public void addEntitySpawns(EntityClassification classification, List<MobSpawnInfo.Spawners> spawners)
      Adds spawns to the list of spawns for the given classification.
      Parameters:
      classification - Entity Classification
      spawners - Spawners to add
    • removeEntitySpawn

      public void removeEntitySpawn(EntityClassification classification, MobSpawnInfo.Spawners spawner)
      Removes a spawn from the list of spawns for the given classification.
      Parameters:
      classification - Entity Classification
      spawner - Spawner
    • getEntitySpawns

      public Map<EntityClassification,List<MobSpawnInfo.Spawners>> getEntitySpawns()
      Gets an unmodifiable view of the map of spawns based on entity classification that is used to fill in the various spawn lists for the structure.