Paper/patches/api/0217-Allow-delegation-to-vanilla-chunk-gen.patch

86 lines
3.3 KiB
Diff
Raw Normal View History

2021-06-11 12:02:28 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MiniDigger <admin@minidigger.me>
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 8553330a96d5902110b904da79a91c9900162adf..14200e67d00679eed47402d3789614e31e1b5514 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1569,6 +1569,22 @@ public final class Bukkit {
2021-06-11 12:02:28 +00:00
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 dbfe95698deb1a6bfcc5cebf5916f5a974b293e0..bcb584a244a7e56586571f51baa5cab35780a59e 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1327,6 +1327,20 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
2021-06-11 12:02:28 +00:00
@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
2021-06-14 09:46:59 +00:00
index 9d7592988a2fbcc70f889b0622adbef014054d00..244a8a93c35d5a84e17672ff745051587bca384c 100644
2021-06-11 12:02:28 +00:00
--- 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.
*/