Paper/Spigot-Server-Patches/0421-Fix-items-not-falling-correctly.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

33 lines
1.4 KiB
Diff

From 9536954962f7fc1e7c43193037bbf4e192b11076 Mon Sep 17 00:00:00 2001
From: AJMFactsheets <AJMFactsheets@gmail.com>
Date: Fri, 17 Jan 2020 17:17:54 -0600
Subject: [PATCH] Fix items not falling correctly
Since 1.14, Mojang has added an optimization which skips checking if
an item should fall every fourth tick.
However, Spigot's entity activation range class also has an
optimization which skips ticking active entities every fourth tick.
This can result in a state where an item will never properly fall
due to its move method never being called.
This patch resolves the conflict by offsetting checking an item's
move method from Spigot's entity activation range check.
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 507627a29f6..2926fbb9570 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -86,7 +86,7 @@ public class EntityItem extends Entity {
}
}
- if (!this.onGround || b(this.getMot()) > 9.999999747378752E-6D || (this.ticksLived + this.getId()) % 4 == 0) {
+ if (!this.onGround || b(this.getMot()) > 9.999999747378752E-6D || this.ticksLived % 4 == 3) { // Paper - Ensure checking item movement is always offset from Spigot's entity activation range check
this.move(EnumMoveType.SELF, this.getMot());
float f = 0.98F;
--
2.26.2