geforkt von Mirrors/Paper
90 Zeilen
3.8 KiB
Diff
90 Zeilen
3.8 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 f7df34539f03e2d5bbb2733709dcbcda65a23b29..53c4e5ca208ee17c7c244e416c537c7b63edf194 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -1740,6 +1740,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 48f9b34aa6caf91174af87f0fe694562417dcc60..e48af3822e9f118399c3a1c9358c56efae12e0da 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1457,6 +1457,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 80fcd02e9cb5f432f21b1f68fd8266f296becaa0..0667315e2bd10254aef59c2a6bcceee9d927b6d5 100644
|
|
--- a/src/main/java/org/bukkit/generator/ChunkGenerator.java
|
|
+++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java
|
|
@@ -454,6 +454,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.
|
|
*/
|