Package net.minecraft.world.level
Class NaturalSpawner
java.lang.Object
net.minecraft.world.level.NaturalSpawner
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static interface
static interface
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
(package private) static final int
private static final int
static final int
static final int
private static final MobCategory[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
canSpawnMobAt
(ServerLevel level, StructureManager structureManager, ChunkGenerator generator, MobCategory category, MobSpawnSettings.SpawnerData data, BlockPos pos) static NaturalSpawner.SpawnState
createState
(int spawnableChunkCount, Iterable<Entity> entities, NaturalSpawner.ChunkGetter chunkGetter, LocalMobCapCalculator calculator) private static Mob
getMobForSpawn
(ServerLevel level, EntityType<?> entityType) private static BlockPos
getRandomPosWithin
(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 Biome
getRoughBiome
(BlockPos pos, ChunkAccess chunk) private static BlockPos
getTopNonCollidingPos
(LevelReader level, EntityType<?> entityType, int x, int z) static boolean
isInNetherFortressBounds
(BlockPos pos, ServerLevel level, MobCategory category, StructureManager structureManager) private static boolean
isRightDistanceToPlayerAndSpawnPoint
(ServerLevel level, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double distance) static boolean
isValidEmptySpawnBlock
(BlockGetter block, BlockPos pos, BlockState blockState, FluidState fluidState, EntityType<?> entityType) private static boolean
isValidPositionForMob
(ServerLevel level, Mob mob, double distance) private static boolean
isValidSpawnPostitionForType
(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 void
spawnCategoryForChunk
(MobCategory category, ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback) static void
spawnCategoryForPosition
(MobCategory category, ServerLevel level, BlockPos pos) static void
spawnCategoryForPosition
(MobCategory category, ServerLevel level, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback) static void
spawnForChunk
(ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnState spawnState, boolean spawnFriendlies, boolean spawnMonsters, boolean forcedDespawn) static void
spawnMobsForChunkGeneration
(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)
-