Paper/patches/api/0329-Allow-delegation-to-vanilla-chunk-gen.patch
Nassim Jahnke d8e07590e3
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
5dbedae1 PR-864: Fix Registry#match() failing namespaced inputs
49256865 PR-863: Fix boolean PersistentDataType
9f15450b SPIGOT-7195, SPIGOT-7197: Add DataPack API
ebef5b6a Disable InterfaceIsType Checkstyle check
01d577f5 Slight tweak to boolean PersistentDataType javadoc
d2b99e56 PR-857: Add boolean PersistentDataType

CraftBukkit Changes:
2270366cd PR-1196: Test Registry instances more thoroughly
863dacb7a PR-1191: Do not start on pre-release Java 17
1f2dd8e12 SPIGOT-7362: Properly handle null in CraftBlock#blockFaceToNotch()
dbc70bed5 SPIGOT-7195, SPIGOT-7197: Add DataPack API
2023-06-06 11:09:19 +02:00

90 lines
3.9 KiB
Diff

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 ce47379dec112f204062092e2e056a2e219c7405..d4b522ee3d44ec755046cc406708086b5f5cf625 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1926,6 +1926,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 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 7f289d358480806b6af3a02b88a0f632a5b5681c..feb2c76bd20c1146d22ec1988943e5b94a982de9 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1625,6 +1625,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.