Package net.minecraft.world.level
Class NaturalSpawner
java.lang.Object
net.minecraft.world.level.NaturalSpawner
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interfacestatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Logger(package private) static final intprivate static final intstatic final intstatic final intprivate static final MobCategory[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleancanSpawnMobAt(ServerLevel level, StructureManager structureManager, ChunkGenerator generator, MobCategory category, MobSpawnSettings.SpawnerData data, BlockPos pos) static NaturalSpawner.SpawnStatecreateState(int spawnableChunkCount, Iterable<Entity> entities, NaturalSpawner.ChunkGetter chunkGetter, LocalMobCapCalculator calculator) private static MobgetMobForSpawn(ServerLevel level, EntityType<?> entityType) private static BlockPosgetRandomPosWithin(Level level, LevelChunk chunk) private static Optional<MobSpawnSettings.SpawnerData> getRandomSpawnMobAt(ServerLevel level, StructureManager structureManager, ChunkGenerator generator, MobCategory category, RandomSource random, BlockPos pos) (package private) static BiomegetRoughBiome(BlockPos pos, ChunkAccess chunk) private static BlockPosgetTopNonCollidingPos(LevelReader level, EntityType<?> entityType, int x, int z) static booleanisInNetherFortressBounds(BlockPos pos, ServerLevel level, MobCategory category, StructureManager structureManager) private static booleanisRightDistanceToPlayerAndSpawnPoint(ServerLevel level, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double distance) static booleanisValidEmptySpawnBlock(BlockGetter block, BlockPos pos, BlockState blockState, FluidState fluidState, EntityType<?> entityType) private static booleanisValidPositionForMob(ServerLevel level, Mob mob, double distance) private static booleanisValidSpawnPostitionForType(ServerLevel level, MobCategory category, StructureManager structureManager, ChunkGenerator generator, MobSpawnSettings.SpawnerData data, BlockPos.MutableBlockPos pos, double distance) private static WeightedRandomList<MobSpawnSettings.SpawnerData> mobsAt(ServerLevel level, StructureManager structureManager, ChunkGenerator generator, MobCategory category, BlockPos pos, Holder<Biome> biome) static voidspawnCategoryForChunk(MobCategory category, ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback) static voidspawnCategoryForPosition(MobCategory category, ServerLevel level, BlockPos pos) static voidspawnCategoryForPosition(MobCategory category, ServerLevel level, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback) static voidspawnForChunk(ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnState spawnState, boolean spawnFriendlies, boolean spawnMonsters, boolean forcedDespawn) static voidspawnMobsForChunkGeneration(ServerLevelAccessor levelAccessor, Holder<Biome> biome, ChunkPos chunkPos, RandomSource random)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
MIN_SPAWN_DISTANCE
private static final int MIN_SPAWN_DISTANCE- See Also:
-
SPAWN_DISTANCE_CHUNK
public static final int SPAWN_DISTANCE_CHUNK- See Also:
-
SPAWN_DISTANCE_BLOCK
public static final int SPAWN_DISTANCE_BLOCK- See Also:
-
MAGIC_NUMBER
static final int MAGIC_NUMBER -
SPAWNING_CATEGORIES
-
-
Constructor Details
-
NaturalSpawner
private NaturalSpawner()
-
-
Method Details
-
createState
public static NaturalSpawner.SpawnState createState(int spawnableChunkCount, Iterable<Entity> entities, NaturalSpawner.ChunkGetter chunkGetter, LocalMobCapCalculator calculator) -
getRoughBiome
-
spawnForChunk
public static void spawnForChunk(ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnState spawnState, boolean spawnFriendlies, boolean spawnMonsters, boolean forcedDespawn) -
spawnCategoryForChunk
public static void spawnCategoryForChunk(MobCategory category, ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback) -
spawnCategoryForPosition
-
spawnCategoryForPosition
public static void spawnCategoryForPosition(MobCategory category, ServerLevel level, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback) -
isRightDistanceToPlayerAndSpawnPoint
private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel level, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double distance) -
isValidSpawnPostitionForType
private static boolean isValidSpawnPostitionForType(ServerLevel level, MobCategory category, StructureManager structureManager, ChunkGenerator generator, MobSpawnSettings.SpawnerData data, BlockPos.MutableBlockPos pos, double distance) -
getMobForSpawn
-
isValidPositionForMob
-
getRandomSpawnMobAt
private static Optional<MobSpawnSettings.SpawnerData> getRandomSpawnMobAt(ServerLevel level, StructureManager structureManager, ChunkGenerator generator, MobCategory category, RandomSource random, BlockPos pos) -
canSpawnMobAt
private static boolean canSpawnMobAt(ServerLevel level, StructureManager structureManager, ChunkGenerator generator, MobCategory category, MobSpawnSettings.SpawnerData data, BlockPos pos) -
mobsAt
private static WeightedRandomList<MobSpawnSettings.SpawnerData> mobsAt(ServerLevel level, StructureManager structureManager, ChunkGenerator generator, MobCategory category, BlockPos pos, @Nullable Holder<Biome> biome) -
isInNetherFortressBounds
public static boolean isInNetherFortressBounds(BlockPos pos, ServerLevel level, MobCategory category, StructureManager structureManager) -
getRandomPosWithin
-
isValidEmptySpawnBlock
public static boolean isValidEmptySpawnBlock(BlockGetter block, BlockPos pos, BlockState blockState, FluidState fluidState, EntityType<?> entityType) -
spawnMobsForChunkGeneration
public static void spawnMobsForChunkGeneration(ServerLevelAccessor levelAccessor, Holder<Biome> biome, ChunkPos chunkPos, RandomSource random) -
getTopNonCollidingPos
private static BlockPos getTopNonCollidingPos(LevelReader level, EntityType<?> entityType, int x, int z)
-