#468: Allow delegation of certain elements to Vanilla when using a custom ChunkGenerator

Allows delegation of caves, decorations, mobs and structures to the Vanilla generation algorithms.
Overriding these methods to return true enables that aspect of Vanilla generation, which is applied after the ChunkGenerator's custom generation.

By: konsolas <vincentyntang@gmail.com>
This commit is contained in:
Bukkit/Spigot 2020-02-02 19:27:08 +11:00
parent 30948a8444
commit 26409057b9

View file

@ -24,8 +24,13 @@ import org.jetbrains.annotations.Nullable;
* at a time, although this may not necessarily be the main server thread.
*
* If your generator is capable of fully asynchronous generation, then
* {@link #isParallelCapable()} should be overriden accordingly to allow
* {@link #isParallelCapable()} should be overridden accordingly to allow
* multiple concurrent callers.
*
* Some aspects of world generation can be delegated to the Vanilla generator.
* The methods {@link ChunkGenerator#shouldGenerateCaves()}, {@link ChunkGenerator#shouldGenerateDecorations()},
* {@link ChunkGenerator#shouldGenerateMobs()} and {@link ChunkGenerator#shouldGenerateStructures()} can be
* overridden to enable this.
*/
public abstract class ChunkGenerator {
@ -182,6 +187,46 @@ public abstract class ChunkGenerator {
return false;
}
/**
* Gets if the server should generate Vanilla caves after this
* ChunkGenerator.
*
* @return true if the server should generate Vanilla caves
*/
public boolean shouldGenerateCaves() {
return false;
}
/**
* Gets if the server should generate Vanilla decorations after this
* ChunkGenerator.
*
* @return true if the server should generate Vanilla decorations
*/
public boolean shouldGenerateDecorations() {
return false;
}
/**
* Gets if the server should generate Vanilla mobs after this
* ChunkGenerator.
*
* @return true if the server should generate Vanilla mobs
*/
public boolean shouldGenerateMobs() {
return false;
}
/**
* Gets if the server should generate Vanilla structures after this
* ChunkGenerator.
*
* @return true if the server should generate Vanilla structures
*/
public boolean shouldGenerateStructures() {
return false;
}
/**
* Data for a Chunk.
*/