mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-19 02:11:28 +02:00
f37381ea8a
Removes synchronization from sending packets Makes normal packet sends no longer need to be wrapped and queued like it use to work. Adds more packet queue immunities on top of keep alive to let the following scenarios go out without delay: - Keep Alive - Chat - Kick - All of the packets during the Player Joined World event Hoping that latter one helps join timeout issues more too for slow connections. Removes processing packet queue off of main thread - for the few cases where it is allowed, order is not necessary nor should it even be happening concurrently in first place (handshaking/login/status) Ensures packets sent asynchronously are dispatched on main thread This helps ensure safety for ProtocolLib as packet listeners are commonly accessing world state. This will allow you to schedule a packet to be sent async, but itll be dispatched sync for packet listeners to process. This should solve some deadlock risks This may provide a decent performance improvement because thread synchronization incurs a cache reset so by avoiding ever entering a synchronized block, we get to avoid that, and packet sending is a really hot activity.
36 lines
1.5 KiB
Diff
36 lines
1.5 KiB
Diff
From 743d5c90a28b0f1f0a624cc429a8722d3128d880 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Tue, 31 Mar 2020 03:01:45 -0400
|
|
Subject: [PATCH] Fix unregistering entities from unloading chunks
|
|
|
|
CraftBukkit caused a regression here by making unloading chunks not
|
|
have a ticket added and returning unloaded future.
|
|
|
|
This caused entities who were killed in same tick their chunk is unloading
|
|
to not be able to be removed from the chunk.
|
|
|
|
This then results in dead entities lingering in the Chunk.
|
|
|
|
Combine that with a buggy detail of the previous implementation of
|
|
the Dupe UUID patch, then this was the likely source of the "Ghost entities"
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index 3fc25183ca4..9fbe8fa1b2b 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -1506,9 +1506,9 @@ public class WorldServer extends World {
|
|
}
|
|
|
|
private void removeEntityFromChunk(Entity entity) {
|
|
- IChunkAccess ichunkaccess = this.getChunkAt(entity.chunkX, entity.chunkZ, ChunkStatus.FULL, false);
|
|
+ Chunk ichunkaccess = entity.getCurrentChunk(); // Paper - getChunkAt(x,z,full,false) is broken by CraftBukkit as it won't return an unloading chunk. Use our current chunk reference as this points to what chunk they need to be removed from anyways
|
|
|
|
- if (ichunkaccess instanceof Chunk) {
|
|
+ if (ichunkaccess != null) { // Paper
|
|
((Chunk) ichunkaccess).b(entity);
|
|
}
|
|
|
|
--
|
|
2.26.2
|
|
|