3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/patches/api/0343-Allow-delegation-to-vanilla-chunk-gen.patch

90 Zeilen
3.8 KiB
Diff

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2021-11-27 09:11:43 +01:00
From: MiniDigger <admin@benndorf.dev>
2021-06-11 14:02:28 +02:00
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 09e91f823f01067150546cda2df50eb1b53618d5..b5e545f2122d1fc8f69e11b3d5e4da382382de94 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1860,6 +1860,24 @@ public final class Bukkit {
2021-06-11 14:02:28 +02:00
return server.createChunkData(world);
}
2021-06-11 14:02:28 +02:00
+ // 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.
2021-06-11 14:02:28 +02:00
+ */
+ @NotNull
+ @Deprecated(forRemoval = true)
2021-06-11 14:02:28 +02:00
+ 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 da886acceb4cf7129cdc6fe1b4bea2f428597cb7..ca9b5bcfbde3e8709a535134e5de0867d3d51b29 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1566,6 +1566,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
2021-06-11 14:02:28 +02:00
@NotNull
public ChunkGenerator.ChunkData createChunkData(@NotNull World world);
2021-06-11 14:02:28 +02:00
+ // Paper start
+ /**
+ * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world.
2021-06-11 14:02:28 +02:00
+ *
+ * @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.
2021-06-11 14:02:28 +02:00
+ */
+ @NotNull
+ @Deprecated(forRemoval = true)
2021-06-11 14:02:28 +02:00
+ 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 d14d3851a7b0340668f44f5213f0e18072d7481b..04be4214bc1c4b476c70aea457118e786fa67eff 100644
2021-06-11 14:02:28 +02:00
--- 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 {
2021-06-11 14:02:28 +02:00
return false;
}
2021-06-11 14:02:28 +02:00
+ // 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.
*/