Package net.minecraftforge.event.world
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 aEventPriority
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 Summary
Fields Modifier and Type Field Description private java.util.Map<EntityClassification,java.util.List<MobSpawnInfo.Spawners>>
entitySpawns
private java.util.Map<EntityClassification,java.util.List<MobSpawnInfo.Spawners>>
entitySpawnsUnmodifiable
private java.util.Map<EntityClassification,java.util.List<MobSpawnInfo.Spawners>>
entitySpawnsUnmodifiableLists
private boolean
insideOnly
private Structure<?>
structure
-
Constructor Summary
Constructors Constructor Description StructureSpawnListGatherEvent(Structure<?> structure)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEntitySpawn(EntityClassification classification, MobSpawnInfo.Spawners spawner)
Adds a spawn to the list of spawns for the given classification.void
addEntitySpawns(EntityClassification classification, java.util.List<MobSpawnInfo.Spawners> spawners)
Adds spawns to the list of spawns for the given classification.java.util.Map<EntityClassification,java.util.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.java.util.List<MobSpawnInfo.Spawners>
getEntitySpawns(EntityClassification classification)
Gets an unmodifiable view of the the list representing the entity spawns for the given classification.private java.util.List<MobSpawnInfo.Spawners>
getOrCreateEntitySpawns(EntityClassification classification)
Gets the internal spawn list for a given entity classification, or adds one if needed.Structure<?>
getStructure()
boolean
isInsideOnly()
Checks if spawns for the structure are restricted to being inside the individual pieces of the structure.void
removeEntitySpawn(EntityClassification classification, MobSpawnInfo.Spawners spawner)
Removes a spawn from the list of spawns for the given classification.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.
-
-
-
Field Detail
-
structure
private final Structure<?> structure
-
entitySpawns
private final java.util.Map<EntityClassification,java.util.List<MobSpawnInfo.Spawners>> entitySpawns
-
entitySpawnsUnmodifiableLists
private final java.util.Map<EntityClassification,java.util.List<MobSpawnInfo.Spawners>> entitySpawnsUnmodifiableLists
-
entitySpawnsUnmodifiable
private final java.util.Map<EntityClassification,java.util.List<MobSpawnInfo.Spawners>> entitySpawnsUnmodifiable
-
insideOnly
private boolean insideOnly
-
-
Constructor Detail
-
StructureSpawnListGatherEvent
public StructureSpawnListGatherEvent(Structure<?> structure)
-
-
Method Detail
-
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 java.util.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 java.util.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 Classificationspawner
- Spawner
-
addEntitySpawns
public void addEntitySpawns(EntityClassification classification, java.util.List<MobSpawnInfo.Spawners> spawners)
Adds spawns to the list of spawns for the given classification.- Parameters:
classification
- Entity Classificationspawners
- 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 Classificationspawner
- Spawner
-
getEntitySpawns
public java.util.Map<EntityClassification,java.util.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.
-
-