Rename package from io.papermc.paper.world.gen to io.papermc.paper.world.generation (#5894)

This commit is contained in:
Jason 2021-06-19 22:02:27 -07:00 committed by GitHub
parent c4c6e26c00
commit 4bf6a631e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -4,13 +4,13 @@ Date: Sat, 19 Jun 2021 20:15:29 -0700
Subject: [PATCH] Add Feature Stage API
diff --git a/src/main/java/io/papermc/paper/world/gen/ProtoWorld.java b/src/main/java/io/papermc/paper/world/gen/ProtoWorld.java
diff --git a/src/main/java/io/papermc/paper/world/generation/ProtoWorld.java b/src/main/java/io/papermc/paper/world/generation/ProtoWorld.java
new file mode 100644
index 0000000000000000000000000000000000000000..63de080e945dfa0e63e6f3c63e498f20481dab27
--- /dev/null
+++ b/src/main/java/io/papermc/paper/world/gen/ProtoWorld.java
+++ b/src/main/java/io/papermc/paper/world/generation/ProtoWorld.java
@@ -0,0 +1,270 @@
+package io.papermc.paper.world.gen;
+package io.papermc.paper.world.generation;
+
+import org.bukkit.World;
+import org.bukkit.block.data.BlockData;
@ -281,7 +281,7 @@ index 0000000000000000000000000000000000000000..63de080e945dfa0e63e6f3c63e498f20
+ @NotNull <T extends Entity> T spawn(@NotNull Vector location, @NotNull Class<T> clazz, @Nullable Consumer<T> function, @NotNull CreatureSpawnEvent.SpawnReason reason) throws IllegalArgumentException;
+}
diff --git a/src/main/java/org/bukkit/generator/ChunkGenerator.java b/src/main/java/org/bukkit/generator/ChunkGenerator.java
index 244a8a93c35d5a84e17672ff745051587bca384c..bb0bddaa6d88396f2226a51ae624472e7614aaa1 100644
index 244a8a93c35d5a84e17672ff745051587bca384c..e547f324790ca27dfb85b030988fc03bfc6107f1 100644
--- a/src/main/java/org/bukkit/generator/ChunkGenerator.java
+++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java
@@ -161,6 +161,19 @@ public abstract class ChunkGenerator {
@ -296,7 +296,7 @@ index 244a8a93c35d5a84e17672ff745051587bca384c..bb0bddaa6d88396f2226a51ae624472e
+ * @param world ProtoWorld to generate decorations with.
+ */
+ @SuppressWarnings("unused")
+ public void generateDecorations(@NotNull io.papermc.paper.world.gen.ProtoWorld world) {
+ public void generateDecorations(@NotNull io.papermc.paper.world.generation.ProtoWorld world) {
+ // Do nothing by default to maintain compatibility with existing generators.
+ }
+ // Paper end

View File

@ -4,13 +4,13 @@ Date: Sat, 19 Jun 2021 20:15:59 -0700
Subject: [PATCH] Add Feature Generation API
diff --git a/src/main/java/io/papermc/paper/world/gen/CraftProtoWorld.java b/src/main/java/io/papermc/paper/world/gen/CraftProtoWorld.java
diff --git a/src/main/java/io/papermc/paper/world/generation/CraftProtoWorld.java b/src/main/java/io/papermc/paper/world/generation/CraftProtoWorld.java
new file mode 100644
index 0000000000000000000000000000000000000000..33de2d14a90b405c6c0057e1f01d38a5c9e0d3f2
index 0000000000000000000000000000000000000000..90a7c87d859d5d4f948a416eda0afbdf802e86ed
--- /dev/null
+++ b/src/main/java/io/papermc/paper/world/gen/CraftProtoWorld.java
+++ b/src/main/java/io/papermc/paper/world/generation/CraftProtoWorld.java
@@ -0,0 +1,94 @@
+package io.papermc.paper.world.gen;
+package io.papermc.paper.world.generation;
+
+import net.minecraft.core.BlockPos;
+import net.minecraft.server.level.WorldGenRegion;
@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..33de2d14a90b405c6c0057e1f01d38a5
+}
+
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
index 46ce973ca68420825316352ad4df907edf52bfec..bd1794ac7c7d736457203b4773f89af23d21a63d 100644
index 46ce973ca68420825316352ad4df907edf52bfec..65e9ecda0df8a22f93f5979a8c9ac74e9f0ba042 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
@@ -191,6 +191,12 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
@ -114,7 +114,7 @@ index 46ce973ca68420825316352ad4df907edf52bfec..bd1794ac7c7d736457203b4773f89af2
}
+
+ // Paper start
+ io.papermc.paper.world.gen.CraftProtoWorld protoWorld = new io.papermc.paper.world.gen.CraftProtoWorld(region);
+ io.papermc.paper.world.generation.CraftProtoWorld protoWorld = new io.papermc.paper.world.generation.CraftProtoWorld(region);
+ generator.generateDecorations(protoWorld);
+ protoWorld.clearReference(); // make sure people dont try to use the ProtoWorld after we're done with it.
+ // Paper end