aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-API-Patches/0217-Allow-delegation-to-vanilla-chunk-gen.patch
blob: 77dc33a6a13cc4304ccbf0c258d84f761f4452b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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 2d981b2481dfb428b2f6a27b5649b7e6148a8776..62cc1c74c11f56dcbd1e24e9c5478497742e6351 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1355,6 +1355,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 bad2ae145ca8fd1e7eb07f0507a743c4ffd23030..6e01bf2d52e8bb6de7395f50c12f16c64aef72ae 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1136,6 +1136,20 @@ public interface Server extends PluginMessageRecipient {
     @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 7caef27682f22a77de283dd6f391ec8bc0b0312b..5ba77d40a38e5e592ee265e4fbd510043a0b4345 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.
      */