From f52951980ec7e4527effc8f61ff6b926edf3e857 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Fri, 26 Apr 2019 12:08:49 +1000 Subject: [PATCH] Don't concurrently execute ChunkGenerators by default By: md_5 --- .../org/bukkit/generator/ChunkGenerator.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/generator/ChunkGenerator.java b/paper-api/src/main/java/org/bukkit/generator/ChunkGenerator.java index 629d937602..dd01233380 100644 --- a/paper-api/src/main/java/org/bukkit/generator/ChunkGenerator.java +++ b/paper-api/src/main/java/org/bukkit/generator/ChunkGenerator.java @@ -17,7 +17,15 @@ import org.jetbrains.annotations.Nullable; /** * A chunk generator is responsible for the initial shaping of an entire * chunk. For example, the nether chunk generator should shape netherrack and - * soulsand + * soulsand. + * + * By default only one thread will call + * {@link #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 + * {@link #isParallelCapable()} should be overriden accordingly to allow + * multiple concurrent callers. */ public abstract class ChunkGenerator { @@ -138,6 +146,17 @@ public abstract class ChunkGenerator { return null; } + /** + * Gets if this ChunkGenerator is parallel capable. + * + * See {@link ChunkGenerator} for more information. + * + * @return parallel capable status + */ + public boolean isParallelCapable() { + return false; + } + /** * Data for a Chunk. */