From 7e7a3d372af4ade83bab09fe5f4a42faec58976b Mon Sep 17 00:00:00 2001 From: MiniDigger | Martin Date: Tue, 24 Nov 2020 18:58:34 +0100 Subject: [PATCH] Fix Delegation to vanilla chunk gen This broke in 1.16.1, when upstream changed stuff around and introduced this delegate field. Closes #4097 --- .../Allow-delegation-to-vanilla-chunk-gen.patch | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Spigot-Server-Patches/Allow-delegation-to-vanilla-chunk-gen.patch b/Spigot-Server-Patches/Allow-delegation-to-vanilla-chunk-gen.patch index 59fb6f1d0..674c7297f 100644 --- a/Spigot-Server-Patches/Allow-delegation-to-vanilla-chunk-gen.patch +++ b/Spigot-Server-Patches/Allow-delegation-to-vanilla-chunk-gen.patch @@ -47,6 +47,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + net.minecraft.server.RegionLimitedWorldAccess genRegion = new net.minecraft.server.RegionLimitedWorldAccess(nmsWorld, list); + // call vanilla generator, one feature after another. Order here is important! + net.minecraft.server.ChunkGenerator chunkGenerator = nmsWorld.getChunkProvider().chunkGenerator; ++ if (chunkGenerator instanceof org.bukkit.craftbukkit.generator.CustomChunkGenerator) { ++ chunkGenerator = ((org.bukkit.craftbukkit.generator.CustomChunkGenerator) chunkGenerator).delegate; ++ } + chunkGenerator.createBiomes(nmsWorld.r().b(IRegistry.ay), protoChunk); + chunkGenerator.buildNoise(genRegion, nmsWorld.getStructureManager(), protoChunk); + chunkGenerator.buildBase(genRegion, protoChunk); @@ -86,3 +89,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Set getTiles() { return tiles; } +diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java ++++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java +@@ -0,0 +0,0 @@ import org.bukkit.generator.ChunkGenerator.ChunkData; + + public class CustomChunkGenerator extends InternalChunkGenerator { + +- private final net.minecraft.server.ChunkGenerator delegate; ++ public final net.minecraft.server.ChunkGenerator delegate; // Paper - public + private final ChunkGenerator generator; + private final WorldServer world; + private final Random random = new Random();