Paper/Spigot-Server-Patches/0400-Fix-nether-portal-creation.patch
Aikar f37381ea8a
Optimize Network Manager to not need synchronization
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.
2020-05-06 05:28:47 -04:00

26 Zeilen
1.2 KiB
Diff

From 1325f69d8a53b77ce1222d8becb2df817c717796 Mon Sep 17 00:00:00 2001
From: Michael Himing <mhiming@gmail.com>
Date: Mon, 9 Sep 2019 13:21:17 +1000
Subject: [PATCH] Fix nether portal creation
diff --git a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
index 60330f753fc..c22dbbfbe8b 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
@@ -38,6 +38,11 @@ public class BlockStateListPopulator extends DummyGeneratorAccess {
@Override
public boolean setTypeAndData(BlockPosition position, IBlockData data, int flag) {
+ // Paper start
+ // When a LinkedHashMap entry is overwritten, it keeps its old position. Removing the entry here before adding
+ // a new one ensures that the nether portal blocks are placed last and are not destroyed by physics.
+ list.remove(position);
+ // Paper end
CraftBlockState state = CraftBlockState.getBlockState(world, position, flag);
state.setData(data);
list.put(position, state);
--
2.26.2