Package net.minecraftforge.common.world
Class StructureSpawnManager
java.lang.Object
net.minecraftforge.common.world.StructureSpawnManager
Class to help manage entity spawns inside of structures
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static class
Helper class to keep track of spawns and if the spawns should be restricted to inside the structure pieces. -
Field Summary
Modifier and TypeFieldDescriptionprivate static Map<StructureFeature<?>,StructureSpawnManager.StructureSpawnInfo>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Gathers potential entity spawns for all the different registered structures.private static void
gatherEntitySpawns(Map<StructureFeature<?>,StructureSpawnManager.StructureSpawnInfo> structuresWithSpawns, StructureFeature<?> structure)
getSpawnList(StructureFeature<?> structure, MobCategory classification)
Gets the entity spawn lists for entities of a given classification for a given structure.getStructureSpawns(StructureFeatureManager structureManager, MobCategory classification, BlockPos pos)
Looks up if a given position is within a structure and returns any entity spawns that structure has for the given classification, or null if none are found.
-
Field Details
-
structuresWithSpawns
private static Map<StructureFeature<?>,StructureSpawnManager.StructureSpawnInfo> structuresWithSpawns
-
-
Constructor Details
-
StructureSpawnManager
public StructureSpawnManager()
-
-
Method Details
-
gatherEntitySpawns
public static void gatherEntitySpawns()Gathers potential entity spawns for all the different registered structures. -
gatherEntitySpawns
private static void gatherEntitySpawns(Map<StructureFeature<?>,StructureSpawnManager.StructureSpawnInfo> structuresWithSpawns, StructureFeature<?> structure) -
getStructureSpawns
@Nullable public static WeightedRandomList<MobSpawnSettings.SpawnerData> getStructureSpawns(StructureFeatureManager structureManager, MobCategory classification, BlockPos pos)Looks up if a given position is within a structure and returns any entity spawns that structure has for the given classification, or null if none are found.- Parameters:
structureManager
- Structure Manager, used to check if a position is within a structure.classification
- Entity classificationpos
- Position to get entity spawns of
-
getSpawnList
public static WeightedRandomList<MobSpawnSettings.SpawnerData> getSpawnList(StructureFeature<?> structure, MobCategory classification)Gets the entity spawn lists for entities of a given classification for a given structure.- Parameters:
structure
- The Structureclassification
- The classification to lookup
-