Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 20:40:07 +01:00
b62dfa0bf9
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 39ce5d3a SPIGOT-4399: ItemMeta.equals broken with AttributeModifiers CraftBukkit Changes:1cf8b5dc
SPIGOT-4400: Populators running on existing chunks116cb9a1
SPIGOT-4399: Add attribute modifier equality test5ee1c18a
SPIGOT-4398: Set ASM7_EXPERIMENTAL flag
48 Zeilen
2.9 KiB
Diff
48 Zeilen
2.9 KiB
Diff
From b6cdf80b0353a657001aa33a1bf91d7c3f4a3cde 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 e4fd9bc604..7ffb8f6172 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
|
|
@@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.chunkio;
|
|
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;
|
|
|
|
@@ -13,7 +14,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.19.0
|
|
|