Class ChunkGenerator
- generateNoise(WorldInfo, Random, int, int, ChunkData)
- generateSurface(WorldInfo, Random, int, int, ChunkData)
- generateBedrock(WorldInfo, Random, int, int, ChunkData)
- generateCaves(WorldInfo, Random, int, int, ChunkData)
getBaseHeight(WorldInfo, Random, int, int, HeightMap)
 must be completely thread safe and able to handle multiple concurrent
 callers.
 Some aspects of world generation can be delegated to the Vanilla generator.
 The following methods can be overridden to enable this:
 - shouldGenerateNoise()or- shouldGenerateNoise(WorldInfo, Random, int, int)
- shouldGenerateSurface()or- shouldGenerateSurface(WorldInfo, Random, int, int)
- shouldGenerateCaves()or- shouldGenerateCaves(WorldInfo, Random, int, int)
- shouldGenerateDecorations()or- shouldGenerateDecorations(WorldInfo, Random, int, int)
- shouldGenerateMobs()or- shouldGenerateMobs(WorldInfo, Random, int, int)
- shouldGenerateStructures()or- shouldGenerateStructures(WorldInfo, Random, int, int)
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceDeprecated.static interfaceData for a Chunk.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanTests if the specified location is valid for a natural spawn positionprotected final @NotNull ChunkGenerator.ChunkDatacreateChunkData(@NotNull World world) Deprecated.ChunkGenerator.ChunkDataare now directly providedcreateVanillaChunkData(@NotNull World world, int x, int z) Create a ChunkData for use in a generator, that is populated by the vanilla generator for that worldvoidgenerateBedrock(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ, @NotNull ChunkGenerator.ChunkData chunkData) Shapes the Chunk bedrock layer for the given coordinates.voidgenerateCaves(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ, @NotNull ChunkGenerator.ChunkData chunkData) Shapes the Chunk caves for the given coordinates.generateChunkData(@NotNull World world, @NotNull Random random, int x, int z, @NotNull ChunkGenerator.BiomeGrid biome) Deprecated.The generation is now split up and the new methods should be used, seeChunkGeneratorvoidgenerateNoise(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ, @NotNull ChunkGenerator.ChunkData chunkData) Shapes the Chunk noise for the given coordinates.voidgenerateSurface(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ, @NotNull ChunkGenerator.ChunkData chunkData) Shapes the Chunk surface for the given coordinates.intgetBaseHeight(@NotNull WorldInfo worldInfo, @NotNull Random random, int x, int z, @NotNull HeightMap heightMap) This method is similar toWorld.getHighestBlockAt(int, int, HeightMap).getDefaultBiomeProvider(@NotNull WorldInfo worldInfo) Gets called when noBiomeProvideris set inWorldCreatoror via the server configuration files.getDefaultPopulators(@NotNull World world) Gets a list of defaultBlockPopulators to apply to a given worldgetFixedSpawnLocation(@NotNull World world, @NotNull Random random) Gets a fixed spawn location to use for a given world.booleanDeprecated.the chunk generation code should be thread safebooleanDeprecated.has no effect, bedrock generation is part of the surface step, seeshouldGenerateSurface()booleanGets if the server should generate Vanilla caves.booleanshouldGenerateCaves(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ) Gets if the server should generate Vanilla caves.booleanGets if the server should generate Vanilla decorations after this ChunkGenerator.booleanshouldGenerateDecorations(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ) Gets if the server should generate Vanilla decorations after this ChunkGenerator.booleanGets if the server should generate Vanilla mobs after this ChunkGenerator.booleanshouldGenerateMobs(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ) Gets if the server should generate Vanilla mobs after this ChunkGenerator.booleanGets if the server should generate Vanilla noise.booleanshouldGenerateNoise(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ) Gets if the server should generate Vanilla noise.booleanGets if the server should generate Vanilla structures after this ChunkGenerator.booleanshouldGenerateStructures(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ) Gets if the server should generate Vanilla structures after this ChunkGenerator.booleanGets if the server should generate Vanilla surface.booleanshouldGenerateSurface(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ) Gets if the server should generate Vanilla surface.
- 
Constructor Details- 
ChunkGeneratorpublic ChunkGenerator()
 
- 
- 
Method Details- 
generateNoisepublic void generateNoise(@NotNull @NotNull WorldInfo worldInfo, @NotNull @NotNull Random random, int chunkX, int chunkZ, @NotNull @NotNull ChunkGenerator.ChunkData chunkData) Shapes the Chunk noise for the given coordinates.Notes: This method should never attempt to get the Chunk at the passed coordinates, as doing so may cause an infinite loop. This method should never modify the ChunkGenerator.ChunkDataat a later point of time.The Y-coordinate range should never be hardcoded, to get the Y-coordinate range use the methods ChunkGenerator.ChunkData.getMinHeight()andChunkGenerator.ChunkData.getMaxHeight().If shouldGenerateNoise()is set to true, the givenChunkGenerator.ChunkDatacontains already the Vanilla noise generation.- Parameters:
- worldInfo- The world info of the world this chunk will be used for
- random- The random generator to use
- chunkX- The X-coordinate of the chunk
- chunkZ- The Z-coordinate of the chunk
- chunkData- To modify
 
- 
generateSurfacepublic void generateSurface(@NotNull @NotNull WorldInfo worldInfo, @NotNull @NotNull Random random, int chunkX, int chunkZ, @NotNull @NotNull ChunkGenerator.ChunkData chunkData) Shapes the Chunk surface for the given coordinates.Notes: This method should never attempt to get the Chunk at the passed coordinates, as doing so may cause an infinite loop. This method should never modify the ChunkGenerator.ChunkDataat a later point of time.The Y-coordinate range should never be hardcoded, to get the Y-coordinate range use the methods ChunkGenerator.ChunkData.getMinHeight()andChunkGenerator.ChunkData.getMaxHeight().If shouldGenerateSurface()is set to true, the givenChunkGenerator.ChunkDatacontains already the Vanilla surface generation.- Parameters:
- worldInfo- The world info of the world this chunk will be used for
- random- The random generator to use
- chunkX- The X-coordinate of the chunk
- chunkZ- The Z-coordinate of the chunk
- chunkData- To modify
 
- 
generateBedrockpublic void generateBedrock(@NotNull @NotNull WorldInfo worldInfo, @NotNull @NotNull Random random, int chunkX, int chunkZ, @NotNull @NotNull ChunkGenerator.ChunkData chunkData) Shapes the Chunk bedrock layer for the given coordinates.Notes: This method should never attempt to get the Chunk at the passed coordinates, as doing so may cause an infinite loop. This method should never modify the ChunkGenerator.ChunkDataat a later point of time.The Y-coordinate range should never be hardcoded, to get the Y-coordinate range use the methods ChunkGenerator.ChunkData.getMinHeight()andChunkGenerator.ChunkData.getMaxHeight().- Parameters:
- worldInfo- The world info of the world this chunk will be used for
- random- The random generator to use
- chunkX- The X-coordinate of the chunk
- chunkZ- The Z-coordinate of the chunk
- chunkData- To modify
 
- 
generateCavespublic void generateCaves(@NotNull @NotNull WorldInfo worldInfo, @NotNull @NotNull Random random, int chunkX, int chunkZ, @NotNull @NotNull ChunkGenerator.ChunkData chunkData) Shapes the Chunk caves for the given coordinates.Notes: This method should never attempt to get the Chunk at the passed coordinates, as doing so may cause an infinite loop. This method should never modify the ChunkGenerator.ChunkDataat a later point of time.The Y-coordinate range should never be hardcoded, to get the Y-coordinate range use the methods ChunkGenerator.ChunkData.getMinHeight()andChunkGenerator.ChunkData.getMaxHeight().If shouldGenerateCaves()is set to true, the givenChunkGenerator.ChunkDatacontains already the Vanilla cave generation.- Parameters:
- worldInfo- The world info of the world this chunk will be used for
- random- The random generator to use
- chunkX- The X-coordinate of the chunk
- chunkZ- The Z-coordinate of the chunk
- chunkData- To modify
 
- 
getDefaultBiomeProvider@Nullable public @Nullable BiomeProvider getDefaultBiomeProvider(@NotNull @NotNull WorldInfo worldInfo) Gets called when noBiomeProvideris set inWorldCreatoror via the server configuration files. It is therefore possible that one plugin can provide the Biomes and another one the generation.Notes: If nullis returned, than Vanilla biomes are used.This method only gets called once when the world is loaded. Returning another BiomeProviderlater one is not respected.- Parameters:
- worldInfo- The world info of the world the biome provider will be used for
- Returns:
- BiomeProvider to use to fill the biomes of a chunk
 
- 
getBaseHeightpublic int getBaseHeight(@NotNull @NotNull WorldInfo worldInfo, @NotNull @NotNull Random random, int x, int z, @NotNull @NotNull HeightMap heightMap) This method is similar toWorld.getHighestBlockAt(int, int, HeightMap). With the difference being, that the highest y coordinate should be the block before any surface, bedrock, caves or decoration is applied. Or in other words the highest block when only the noise is present at the chunk.Notes: When this method is not overridden, the Vanilla base height is used. This method should never attempt to get the Chunk at the passed coordinates, or use the method World.getHighestBlockAt(int, int, HeightMap), as doing so may cause an infinite loop.- Parameters:
- worldInfo- The world info of the world this chunk will be used for
- random- The random generator to use
- x- The X-coordinate from world origin
- z- The Z-coordinate from world origin
- heightMap- From the highest block should be get
- Returns:
- The y coordinate of the highest block at the given location
 
- 
generateChunkData@NotNull @Deprecated public @NotNull ChunkGenerator.ChunkData generateChunkData(@NotNull @NotNull World world, @NotNull @NotNull Random random, int x, int z, @NotNull @NotNull ChunkGenerator.BiomeGrid biome) Deprecated.The generation is now split up and the new methods should be used, seeChunkGeneratorShapes the chunk for the given coordinates. This method must return a ChunkData.Notes: This method should never attempt to get the Chunk at the passed coordinates, as doing so may cause an infinite loop This method should never modify a ChunkData after it has been returned. This method must return a ChunkData returned by createChunkData(org.bukkit.World)- Parameters:
- world- The world this chunk will be used for
- random- The random generator to use
- x- The X-coordinate of the chunk
- z- The Z-coordinate of the chunk
- biome- Proposed biome values for chunk - can be updated by generator
- Returns:
- ChunkData containing the types for each block created by this generator
 
- 
createChunkData@NotNull @Deprecated protected final @NotNull ChunkGenerator.ChunkData createChunkData(@NotNull @NotNull World world) Deprecated.ChunkGenerator.ChunkDataare now directly providedCreate a ChunkData for a world.- Parameters:
- world- the world the ChunkData is for
- Returns:
- a new ChunkData for world
 
- 
canSpawnTests if the specified location is valid for a natural spawn position- Parameters:
- world- The world we're testing on
- x- X-coordinate of the block to test
- z- Z-coordinate of the block to test
- Returns:
- true if the location is valid, otherwise false
 
- 
getDefaultPopulatorsGets a list of defaultBlockPopulators to apply to a given world- Parameters:
- world- World to apply to
- Returns:
- List containing any amount of BlockPopulators
 
- 
getFixedSpawnLocation@Nullable public @Nullable Location getFixedSpawnLocation(@NotNull @NotNull World world, @NotNull @NotNull Random random) Gets a fixed spawn location to use for a given world.A null value is returned if a world should not use a fixed spawn point, and will instead attempt to find one randomly. - Parameters:
- world- The world to locate a spawn point for
- random- Random generator to use in the calculation
- Returns:
- Location containing a new spawn point, otherwise null
 
- 
isParallelCapableDeprecated.the chunk generation code should be thread safeGets if this ChunkGenerator is parallel capable. SeeChunkGeneratorfor more information.- Returns:
- parallel capable status
 
- 
shouldGenerateNoisepublic boolean shouldGenerateNoise()Gets if the server should generate Vanilla noise.The Vanilla noise is generated before generateNoise(WorldInfo, Random, int, int, ChunkData)is called.This is method is not called (and has therefore no effect), if shouldGenerateNoise(WorldInfo, Random, int, int)is overridden.- Returns:
- true if the server should generate Vanilla noise
- See Also:
 
- 
shouldGenerateNoisepublic boolean shouldGenerateNoise(@NotNull @NotNull WorldInfo worldInfo, @NotNull @NotNull Random random, int chunkX, int chunkZ) Gets if the server should generate Vanilla noise.The Vanilla noise is generated before generateNoise(WorldInfo, Random, int, int, ChunkData)is called.Only this method is called if both this and shouldGenerateNoise()are overridden.- Parameters:
- worldInfo- The world info of the world this chunk will be used for
- random- The random generator to use
- chunkX- The X-coordinate of the chunk
- chunkZ- The Z-coordinate of the chunk
- Returns:
- true if the server should generate Vanilla noise
- See Also:
 
- 
shouldGenerateSurfacepublic boolean shouldGenerateSurface()Gets if the server should generate Vanilla surface.The Vanilla surface is generated before generateSurface(WorldInfo, Random, int, int, ChunkData)is called.This is method is not called (and has therefore no effect), if shouldGenerateSurface(WorldInfo, Random, int, int)is overridden.- Returns:
- true if the server should generate Vanilla surface
- See Also:
 
- 
shouldGenerateSurfacepublic boolean shouldGenerateSurface(@NotNull @NotNull WorldInfo worldInfo, @NotNull @NotNull Random random, int chunkX, int chunkZ) Gets if the server should generate Vanilla surface.The Vanilla surface is generated before generateSurface(WorldInfo, Random, int, int, ChunkData)is called.Only this method is called if both this and shouldGenerateSurface()are overridden.- Parameters:
- worldInfo- The world info of the world this chunk will be used for
- random- The random generator to use
- chunkX- The X-coordinate of the chunk
- chunkZ- The Z-coordinate of the chunk
- Returns:
- true if the server should generate Vanilla surface
- See Also:
 
- 
shouldGenerateBedrockDeprecated.has no effect, bedrock generation is part of the surface step, seeshouldGenerateSurface()Gets if the server should generate Vanilla bedrock.The Vanilla bedrock is generated before generateBedrock(WorldInfo, Random, int, int, ChunkData)is called.- Returns:
- true if the server should generate Vanilla bedrock
 
- 
shouldGenerateCavespublic boolean shouldGenerateCaves()Gets if the server should generate Vanilla caves.The Vanilla caves are generated before generateCaves(WorldInfo, Random, int, int, ChunkData)is called.This is method is not called (and has therefore no effect), if shouldGenerateCaves(WorldInfo, Random, int, int)is overridden.- Returns:
- true if the server should generate Vanilla caves
- See Also:
 
- 
shouldGenerateCavespublic boolean shouldGenerateCaves(@NotNull @NotNull WorldInfo worldInfo, @NotNull @NotNull Random random, int chunkX, int chunkZ) Gets if the server should generate Vanilla caves.The Vanilla caves are generated before generateCaves(WorldInfo, Random, int, int, ChunkData)is called.Only this method is called if both this and shouldGenerateCaves()are overridden.- Parameters:
- worldInfo- The world info of the world this chunk will be used for
- random- The random generator to use
- chunkX- The X-coordinate of the chunk
- chunkZ- The Z-coordinate of the chunk
- Returns:
- true if the server should generate Vanilla caves
- See Also:
 
- 
shouldGenerateDecorationspublic boolean shouldGenerateDecorations()Gets if the server should generate Vanilla decorations after this ChunkGenerator.The Vanilla decoration are generated before any BlockPopulatorare called.This is method is not called (and has therefore no effect), if shouldGenerateDecorations(WorldInfo, Random, int, int)is overridden.- Returns:
- true if the server should generate Vanilla decorations
- See Also:
 
- 
shouldGenerateDecorationspublic boolean shouldGenerateDecorations(@NotNull @NotNull WorldInfo worldInfo, @NotNull @NotNull Random random, int chunkX, int chunkZ) Gets if the server should generate Vanilla decorations after this ChunkGenerator.The Vanilla decoration are generated before any BlockPopulatorare called.Only this method is called if both this and shouldGenerateDecorations()are overridden.- Parameters:
- worldInfo- The world info of the world this chunk will be used for
- random- The random generator to use
- chunkX- The X-coordinate of the chunk
- chunkZ- The Z-coordinate of the chunk
- Returns:
- true if the server should generate Vanilla decorations
- See Also:
 
- 
shouldGenerateMobspublic boolean shouldGenerateMobs()Gets if the server should generate Vanilla mobs after this ChunkGenerator.This is method is not called (and has therefore no effect), if shouldGenerateMobs(WorldInfo, Random, int, int)is overridden.- Returns:
- true if the server should generate Vanilla mobs
- See Also:
 
- 
shouldGenerateMobspublic boolean shouldGenerateMobs(@NotNull @NotNull WorldInfo worldInfo, @NotNull @NotNull Random random, int chunkX, int chunkZ) Gets if the server should generate Vanilla mobs after this ChunkGenerator.Only this method is called if both this and shouldGenerateMobs()are overridden.- Parameters:
- worldInfo- The world info of the world this chunk will be used for
- random- The random generator to use
- chunkX- The X-coordinate of the chunk
- chunkZ- The Z-coordinate of the chunk
- Returns:
- true if the server should generate Vanilla mobs
- See Also:
 
- 
shouldGenerateStructurespublic boolean shouldGenerateStructures()Gets if the server should generate Vanilla structures after this ChunkGenerator.This is method is not called (and has therefore no effect), if shouldGenerateStructures(WorldInfo, Random, int, int)is overridden.- Returns:
- true if the server should generate Vanilla structures
- See Also:
 
- 
createVanillaChunkData@NotNull public @NotNull ChunkGenerator.ChunkData createVanillaChunkData(@NotNull @NotNull World world, int x, int z) Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world- Parameters:
- world- the world to create the ChunkData for
- x- the x coordinate of the chunk
- z- the z coordinate of the chunk
- Returns:
- a new ChunkData for the world
 
- 
shouldGenerateStructurespublic boolean shouldGenerateStructures(@NotNull @NotNull WorldInfo worldInfo, @NotNull @NotNull Random random, int chunkX, int chunkZ) Gets if the server should generate Vanilla structures after this ChunkGenerator.Only this method is called if both this and shouldGenerateStructures()are overridden.- Parameters:
- worldInfo- The world info of the world this chunk will be used for
- random- The random generator to use
- chunkX- The X-coordinate of the chunk
- chunkZ- The Z-coordinate of the chunk
- Returns:
- true if the server should generate Vanilla structures
- See Also:
 
 
- 
BiomeProvider