From 1ef1ffd664b55d9dc9800023182c779daff2594a Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 25 Jul 2018 19:32:06 +1000 Subject: SPIGOT-4137: Fix World.regenerateChunk --- nms-patches/ChunkProviderServer.patch | 23 +++++++++++++++++++---- nms-patches/ChunkTaskScheduler.patch | 15 +++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 nms-patches/ChunkTaskScheduler.patch (limited to 'nms-patches') diff --git a/nms-patches/ChunkProviderServer.patch b/nms-patches/ChunkProviderServer.patch index 008a069b..aad3ec49 100644 --- a/nms-patches/ChunkProviderServer.patch +++ b/nms-patches/ChunkProviderServer.patch @@ -57,16 +57,31 @@ } } -@@ -150,7 +162,7 @@ +@@ -147,10 +159,21 @@ + return this.g.c(); + } + ++ // CraftBukkit start public CompletableFuture generateChunk(int i, int j) { ++ return this.generateChunk(i, j, false); ++ } ++ ++ public CompletableFuture generateChunk(int i, int j, boolean force) { this.g.b(); - this.g.a(new ChunkCoordIntPair(i, j)); +- this.g.a(new ChunkCoordIntPair(i, j)); - CompletableFuture completablefuture = this.g.c(); ++ ++ ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); ++ if (force) { ++ this.f.forcePolluteCache(chunkcoordintpair); ++ } ++ this.g.a(chunkcoordintpair); ++ // CraftBukkit end + CompletableFuture completablefuture = this.g.c(); // CraftBukkit - decompile error return completablefuture.thenApply(this::a); } -@@ -268,10 +280,12 @@ +@@ -268,10 +291,12 @@ Chunk chunk = (Chunk) this.chunks.get(olong); if (chunk != null && chunk.d) { @@ -83,7 +98,7 @@ ++i; } } -@@ -284,6 +298,40 @@ +@@ -284,6 +309,40 @@ return false; } diff --git a/nms-patches/ChunkTaskScheduler.patch b/nms-patches/ChunkTaskScheduler.patch new file mode 100644 index 00000000..dc448358 --- /dev/null +++ b/nms-patches/ChunkTaskScheduler.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/server/ChunkTaskScheduler.java ++++ b/net/minecraft/server/ChunkTaskScheduler.java +@@ -39,6 +39,12 @@ + this.f = iasynctaskhandler; + } + ++ // CraftBukkit start ++ public void forcePolluteCache(ChunkCoordIntPair chunkcoordintpair) { ++ this.g.put(chunkcoordintpair.a(), new Scheduler.a(chunkcoordintpair, new ProtoChunk(chunkcoordintpair, ChunkConverter.a), ChunkStatus.EMPTY)); ++ } ++ // CraftBukkit end ++ + protected Scheduler.a a(ChunkCoordIntPair chunkcoordintpair) { + return (Scheduler.a) this.g.computeIfAbsent(Long.valueOf(chunkcoordintpair.a()), (olong) -> { + ProtoChunk protochunk = this.a(chunkcoordintpair.x, chunkcoordintpair.z); -- cgit v1.2.3