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 Map<MobCategory,List<MobSpawnSettings.SpawnerData>>
private Map<MobCategory,List<MobSpawnSettings.SpawnerData>>
private Map<MobCategory,List<MobSpawnSettings.SpawnerData>>
private boolean
private StructureFeature<?>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEntitySpawn(MobCategory classification, MobSpawnSettings.SpawnerData spawner)
Adds a spawn to the list of spawns for the given classification.void
addEntitySpawns(MobCategory classification, List<MobSpawnSettings.SpawnerData> 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(MobCategory classification)
Gets an unmodifiable view of the the list representing the entity spawns for the given classification.private List<MobSpawnSettings.SpawnerData>
getOrCreateEntitySpawns(MobCategory classification)
Gets the internal spawn list for a given entity classification, or adds one if needed.boolean
Checks if spawns for the structure are restricted to being inside the individual pieces of the structure.void
removeEntitySpawn(MobCategory classification, MobSpawnSettings.SpawnerData 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(MobCategory classification, List<MobSpawnSettings.SpawnerData> 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.
-