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 overridden accordingly to allow
multiple concurrent callers.
Some aspects of world generation can be delegated to the Vanilla generator.
The methods shouldGenerateCaves()
, shouldGenerateDecorations()
,
shouldGenerateMobs()
and shouldGenerateStructures()
can be
overridden to enable this.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(@NotNull World world,
int x,
int z)
Tests if the specified location is valid for a natural spawn position
|
protected @NotNull ChunkGenerator.ChunkData |
createChunkData(@NotNull World world)
Create a ChunkData for a world.
|
@NotNull ChunkGenerator.ChunkData |
createVanillaChunkData(@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
|
@NotNull ChunkGenerator.ChunkData |
generateChunkData(@NotNull World world,
@NotNull Random random,
int x,
int z,
@NotNull ChunkGenerator.BiomeGrid biome)
Shapes the chunk for the given coordinates.
|
@NotNull List<BlockPopulator> |
getDefaultPopulators(@NotNull World world)
Gets a list of default
BlockPopulator s to apply to a given
world |
@Nullable Location |
getFixedSpawnLocation(@NotNull World world,
@NotNull Random random)
Gets a fixed spawn location to use for a given world.
|
boolean |
isParallelCapable()
Gets if this ChunkGenerator is parallel capable.
|
boolean |
shouldGenerateCaves()
Gets if the server should generate Vanilla caves after this
ChunkGenerator.
|
boolean |
shouldGenerateDecorations()
Gets if the server should generate Vanilla decorations after this
ChunkGenerator.
|
boolean |
shouldGenerateMobs()
Gets if the server should generate Vanilla mobs after this
ChunkGenerator.
|
boolean |
shouldGenerateStructures()
Gets if the server should generate Vanilla structures after this
ChunkGenerator.
|
@NotNull public @NotNull ChunkGenerator.ChunkData generateChunkData(@NotNull @NotNull World world, @NotNull @NotNull Random random, int x, int z, @NotNull @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 @NotNull ChunkGenerator.ChunkData createChunkData(@NotNull @NotNull World world)
world
- the world the ChunkData is forpublic boolean canSpawn(@NotNull @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 @NotNull List<BlockPopulator> getDefaultPopulators(@NotNull @NotNull World world)
BlockPopulator
s to apply to a given
worldworld
- World to apply to@Nullable public @Nullable Location getFixedSpawnLocation(@NotNull @NotNull World world, @NotNull @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.public boolean shouldGenerateCaves()
public boolean shouldGenerateDecorations()
public boolean shouldGenerateMobs()
public boolean shouldGenerateStructures()
@NotNull public @NotNull ChunkGenerator.ChunkData createVanillaChunkData(@NotNull @NotNull World world, int x, int z)
world
- the world to create the ChunkData forx
- the x coordinate of the chunkz
- the z coordinate of the chunkCopyright © 2021. All rights reserved.