Paper/Spigot-API-Patches/0216-Allow-delegation-to-vanilla-chunk-gen.patch
Daniel Ennis c97ce029e9
1.16.2 Release (#4123)
PaperMC believes that 1.16.2 is now ready for general release as we fixed the main issue plagueing the 1.16.x release, the MapLike data conversion issues.

Until now, it was not safe for a server to convert a world to 1.16.2 without data conversion issues around villages and potentially other things. If you did, those MapLike errors meant something went wrong.

This is now resolved.

Big thanks to all those that helped, notably @BillyGalbreath and @Proximyst who did large parts of the update process with me.

Please as always, backup your worlds and test before updating to 1.16.2!

If you update to 1.16.2, there is no going back to an older build than this.

---------------------------------

Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com>
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
Co-authored-by: krolik-exe <69214078+krolik-exe@users.noreply.github.com>
Co-authored-by: BillyGalbreath <BillyGalbreath@users.noreply.github.com>
Co-authored-by: stonar96 <minecraft.stonar96@gmail.com>
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
Co-authored-by: Jason <jasonpenilla2@me.com>
Co-authored-by: kashike <kashike@vq.lc>
Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com>
Co-authored-by: KennyTV <kennytv@t-online.de>
Co-authored-by: commandblockguy <commandblockguy1@gmail.com>
Co-authored-by: DigitalRegent <misterwener@gmail.com>
Co-authored-by: ishland <ishlandmc@yeah.net>
2020-08-24 22:40:19 -04:00

86 lines
3.3 KiB
Diff

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.
*/