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 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.-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Field Summary
Modifier and TypeFieldDescriptionprivate final Map<EntityClassification,
List<MobSpawnInfo.Spawners>> private final Map<EntityClassification,
List<MobSpawnInfo.Spawners>> private final Map<EntityClassification,
List<MobSpawnInfo.Spawners>> private boolean
private final Structure<?>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEntitySpawn
(EntityClassification classification, MobSpawnInfo.Spawners spawner) Adds a spawn to the list of spawns for the given classification.void
addEntitySpawns
(EntityClassification classification, List<MobSpawnInfo.Spawners> spawners) Adds spawns to the list of spawns for the given classification.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.getEntitySpawns
(EntityClassification classification) Gets an unmodifiable view of the the list representing the entity spawns for the given classification.private List<MobSpawnInfo.Spawners>
getOrCreateEntitySpawns
(EntityClassification classification) Gets the internal spawn list for a given entity classification, or adds one if needed.Structure<?>
boolean
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.Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getParentListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult, setup
-
Field Details
-
structure
-
entitySpawns
-
entitySpawnsUnmodifiableLists
-
entitySpawnsUnmodifiable
-
insideOnly
private boolean insideOnly
-
-
Constructor Details
-
StructureSpawnListGatherEvent
-
-
Method Details
-
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
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
Gets the internal spawn list for a given entity classification, or adds one if needed. (This includes adding it to the unmodifiable view) -
addEntitySpawn
Adds a spawn to the list of spawns for the given classification.- Parameters:
classification
- Entity Classificationspawner
- 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 Classificationspawners
- Spawners to add
-
removeEntitySpawn
Removes a spawn from the list of spawns for the given classification.- Parameters:
classification
- Entity Classificationspawner
- Spawner
-
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.
-