From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MiniDigger Date: Wed, 29 Apr 2020 02:09:17 +0200 Subject: [PATCH] Allow delegation to vanilla chunk gen diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java index 5bbb9e858253d31dc58d1eda1c88c8a84d2fb65a..191fbd4441b9287dd0ae30e2a636c1f95e382572 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -1514,6 +1514,22 @@ public final class Bukkit { return server.createChunkData(world); } + // Paper start + /** + * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world + * + * @param world the world to create the ChunkData for + * @param x the x coordinate of the chunk + * @param z the z coordinate of the chunk + * @return a new ChunkData for the world + * + */ + @NotNull + public static ChunkGenerator.ChunkData createVanillaChunkData(@NotNull World world, int x, int z) { + return server.createVanillaChunkData(world, x, z); + } + // Paper stop + /** * Creates a boss bar instance to display to players. The progress * defaults to 1.0 diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java index 00904a803418865521c52088bf6fe9db2eb28b31..c8798700fbb3885c7522e1170242cba573826358 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1276,6 +1276,20 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @NotNull public ChunkGenerator.ChunkData createChunkData(@NotNull World world); + // Paper start + /** + * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world + * + * @param world the world to create the ChunkData for + * @param x the x coordinate of the chunk + * @param z the z coordinate of the chunk + * @return a new ChunkData for the world + * + */ + @NotNull + ChunkGenerator.ChunkData createVanillaChunkData(@NotNull World world, int x, int z); + // Paper end + /** * Creates a boss bar instance to display to players. The progress * defaults to 1.0 diff --git a/src/main/java/org/bukkit/generator/ChunkGenerator.java b/src/main/java/org/bukkit/generator/ChunkGenerator.java index 9d7592988a2fbcc70f889b0622adbef014054d00..244a8a93c35d5a84e17672ff745051587bca384c 100644 --- a/src/main/java/org/bukkit/generator/ChunkGenerator.java +++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java @@ -227,6 +227,22 @@ public abstract class ChunkGenerator { return false; } + // Paper start + /** + * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world + * + * @param world the world to create the ChunkData for + * @param x the x coordinate of the chunk + * @param z the z coordinate of the chunk + * @return a new ChunkData for the world + * + */ + @NotNull + public ChunkData createVanillaChunkData(@NotNull World world, int x, int z) { + return Bukkit.getServer().createVanillaChunkData(world, x, z); + } + // Paper end + /** * Data for a Chunk. */