public abstract class ChunkGenerator extends Object
generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)
at a time, although this may not necessarily be the main server thread.
If your generator is capable of fully asynchronous generation, then
isParallelCapable()
should be overriden accordingly to allow
multiple concurrent callers.Modifier and Type | Class and Description |
---|---|
static interface |
ChunkGenerator.BiomeGrid
Interface to biome section for chunk to be generated: initialized with
default values for world type and seed.
|
static interface |
ChunkGenerator.ChunkData
Data for a Chunk.
|
Constructor and Description |
---|
ChunkGenerator() |
Modifier and Type | Method and Description |
---|---|
boolean |
canSpawn(World world,
int x,
int z)
Tests if the specified location is valid for a natural spawn position
|
protected ChunkGenerator.ChunkData |
createChunkData(World world)
Create a ChunkData for a world.
|
ChunkGenerator.ChunkData |
generateChunkData(World world,
Random random,
int x,
int z,
ChunkGenerator.BiomeGrid biome)
Shapes the chunk for the given coordinates.
|
List<BlockPopulator> |
getDefaultPopulators(World world)
Gets a list of default
BlockPopulator s to apply to a given
world |
Location |
getFixedSpawnLocation(World world,
Random random)
Gets a fixed spawn location to use for a given world.
|
boolean |
isParallelCapable()
Gets if this ChunkGenerator is parallel capable.
|
@NotNull public ChunkGenerator.ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z, @NotNull ChunkGenerator.BiomeGrid biome)
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)
world
- The world this chunk will be used forrandom
- The random generator to usex
- The X-coordinate of the chunkz
- The Z-coordinate of the chunkbiome
- Proposed biome values for chunk - can be updated by
generator@NotNull protected final ChunkGenerator.ChunkData createChunkData(@NotNull World world)
world
- the world the ChunkData is forpublic boolean canSpawn(@NotNull World world, int x, int z)
world
- The world we're testing onx
- X-coordinate of the block to testz
- Z-coordinate of the block to test@NotNull public List<BlockPopulator> getDefaultPopulators(@NotNull World world)
BlockPopulator
s to apply to a given
worldworld
- World to apply to@Nullable public Location getFixedSpawnLocation(@NotNull World world, @NotNull Random random)
A null value is returned if a world should not use a fixed spawn point, and will instead attempt to find one randomly.
world
- The world to locate a spawn point forrandom
- Random generator to use in the calculationpublic boolean isParallelCapable()
ChunkGenerator
for more information.Copyright © 2022. All rights reserved.