aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0322-Allow-delegation-to-vanilla-chunk-gen.patch
blob: 664279d84f8cc5ff16483379057244278a34b43e (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
86
87
88
89
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MiniDigger <admin@benndorf.dev>
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 c3d3c7d05a03658157d49c6ff1ea1d7d085a6fd4..fa7a63ea108971790c28c4f32d280ee6f2a86c0b 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2105,6 +2105,24 @@ 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
+     * @deprecated The new multi-stage worldgen API allows a similar effect by overriding all of the "shouldGenerate..." methods to
+     * return true, and then modifying the chunkdata in a later stage such as surface or bedrock generation.
+     */
+    @NotNull
+    @Deprecated(forRemoval = true)
+    public static ChunkGenerator.ChunkData createVanillaChunkData(@NotNull World world, int x, int z) {
+        return server.createVanillaChunkData(world, x, 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/Server.java b/src/main/java/org/bukkit/Server.java
index 61ee087ec4a75ee8b10e204b4cdd1bab5f066819..90b1368303562e1b4af2e658e60ac564bd49ad5f 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1779,6 +1779,22 @@ 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
+     * @deprecated The new multi-stage worldgen API allows a similar effect by overriding all of the "shouldGenerate..." methods to
+     * return true, and then modifying the chunkdata in a later stage such as surface or bedrock generation.
+     */
+    @NotNull
+    @Deprecated(forRemoval = true)
+    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 7e7a53b41013f1bf8956c0e278820f18d77b2f0d..c942b7101a38ac7dc70e11e87afa1f9210000bc1 100644
--- a/src/main/java/org/bukkit/generator/ChunkGenerator.java
+++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java
@@ -577,6 +577,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
+
     /**
      * Gets if the server should generate Vanilla structures after this
      * ChunkGenerator.