mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 19:22:50 +01:00
835bc39b03
Updated Upstream (Bukkit/CraftBukkit/Spigot) Bukkit Changes: 2dcc44dc SPIGOT-4307: Fix hacky API for banners on shields e0fc6572 SPIGOT-4309: Add "forced" display of particles efeeab2f Add index to README.md for easier navigation f502bc6f Update to Minecraft 1.13.1 CraftBukkit Changes:d0bb0a1d
Fix some tests randomly failing997d378d
Fix client stall in specific teleportation scenariosb3dc2366
SPIGOT-4307: Fix hacky API for banners on shields2a271162
SPIGOT-4301: Fix more invalid enchants5d0d83bb
SPIGOT-4309: Add "forced" display of particlesa6772578
Add additional tests for CraftBlockDatace1af0c3
Update to Minecraft 1.13.1 Spigot Changes: 2440e189 Rebuild patches 4ecffced Update to Minecraft 1.13.1
47 lines
2.9 KiB
Diff
47 lines
2.9 KiB
Diff
From 2524c5992b465b4db1ccf20a94fd78e6decf5d53 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Fri, 27 May 2016 21:41:26 -0400
|
|
Subject: [PATCH] Ensure Chunks never ever load async
|
|
|
|
Safely pushes the operation to main thread, then back to the posting thread
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
|
|
index 7b7a3d01b9..9aaca21a79 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
|
|
@@ -4,6 +4,7 @@ import com.destroystokyo.paper.PaperConfig;
|
|
import net.minecraft.server.Chunk;
|
|
import net.minecraft.server.ChunkProviderServer;
|
|
import net.minecraft.server.ChunkRegionLoader;
|
|
+import net.minecraft.server.MCUtil; // Paper
|
|
import net.minecraft.server.World;
|
|
import org.bukkit.craftbukkit.util.AsynchronousExecutor;
|
|
|
|
@@ -14,7 +15,7 @@ public class ChunkIOExecutor {
|
|
private static final AsynchronousExecutor<QueuedChunk, Chunk, Runnable, RuntimeException> instance = new AsynchronousExecutor<QueuedChunk, Chunk, Runnable, RuntimeException>(new ChunkIOProvider(), BASE_THREADS);
|
|
|
|
public static Chunk syncChunkLoad(World world, ChunkRegionLoader loader, ChunkProviderServer provider, int x, int z) {
|
|
- return instance.getSkipQueue(new QueuedChunk(x, z, loader, world, provider));
|
|
+ return MCUtil.ensureMain("Async Chunk Load", () -> instance.getSkipQueue(new QueuedChunk(x, z, loader, world, provider))); // Paper
|
|
}
|
|
|
|
public static void queueChunkLoad(World world, ChunkRegionLoader loader, ChunkProviderServer provider, int x, int z, Runnable runnable) {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
|
index 52a8c48fa4..4cfe24df15 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
|
@@ -35,9 +35,9 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
|
|
|
|
// sync stuff
|
|
public void callStage2(QueuedChunk queuedChunk, Chunk chunk) throws RuntimeException {
|
|
- if (chunk == null) {
|
|
+ if (chunk == null || queuedChunk.provider.chunks.containsKey(ChunkCoordIntPair.a(queuedChunk.x, queuedChunk.z))) { // Paper - also call original if it was already loaded
|
|
// If the chunk loading failed just do it synchronously (may generate)
|
|
- // queuedChunk.provider.originalGetChunkAt(queuedChunk.x, queuedChunk.z);
|
|
+ queuedChunk.provider.getChunkAt(queuedChunk.x, queuedChunk.z, true, true); // Paper - actually call original if it was already loaded
|
|
return;
|
|
}
|
|
try (Timing ignored = queuedChunk.provider.world.timings.chunkIOStage2.startTimingIfSync()) { // Paper
|
|
--
|
|
2.18.0
|
|
|