From de5b1da681062a27c0a2f315fb20b64d6c808028 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Tue, 3 Jan 2023 14:42:58 +0100 Subject: [PATCH] Fix operator precedence bug (#8756) --- patches/server/0338-Fix-items-not-falling-correctly.patch | 4 ++-- patches/server/0342-Entity-Activation-Range-2.0.patch | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/patches/server/0338-Fix-items-not-falling-correctly.patch b/patches/server/0338-Fix-items-not-falling-correctly.patch index 439e413ba7..15d477738b 100644 --- a/patches/server/0338-Fix-items-not-falling-correctly.patch +++ b/patches/server/0338-Fix-items-not-falling-correctly.patch @@ -28,7 +28,7 @@ index 02bd99934066b35a3f4fd59370cdabf0640ee218..477c9358a09067ace4d0fe3f519148fe float f1 = 0.98F; diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index e2dfc4d9a16a738dd0fe91838603e1d4370afa56..2861c585710eaa00541ff417a29f1f6a2fb5b46a 100644 +index e2dfc4d9a16a738dd0fe91838603e1d4370afa56..65a95703bb842d5aeacb606842621198c8aab7ab 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -257,7 +257,7 @@ public class ActivationRange @@ -36,7 +36,7 @@ index e2dfc4d9a16a738dd0fe91838603e1d4370afa56..2861c585710eaa00541ff417a29f1f6a } // Add a little performance juice to active entities. Skip 1/4 if not immune. - } else if ( !entity.defaultActivationState && entity.tickCount % 4 == 0 && !ActivationRange.checkEntityImmunities( entity ) ) -+ } else if ( !entity.defaultActivationState && entity.tickCount + entity.getId() + 1 % 4 == 0 && !ActivationRange.checkEntityImmunities( entity ) ) // Paper - Ensure checking item movement is offset from Spigot's entity activation range check ++ } else if ( !entity.defaultActivationState && (entity.tickCount + entity.getId()) % 4 == 3 && !ActivationRange.checkEntityImmunities( entity ) ) // Paper - Ensure checking item movement is offset from Spigot's entity activation range check { isActive = false; } diff --git a/patches/server/0342-Entity-Activation-Range-2.0.patch b/patches/server/0342-Entity-Activation-Range-2.0.patch index 54ab7c6c4d..d8b96e1857 100644 --- a/patches/server/0342-Entity-Activation-Range-2.0.patch +++ b/patches/server/0342-Entity-Activation-Range-2.0.patch @@ -112,7 +112,7 @@ index f85cbcd0ba398bdd2622a2e1aaba7de24d53038a..3b528a6adaa431ebdf11ce2ce8ea3c99 } else { passenger.stopRiding(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 15625d54c32530eae73d6360ef68ffd1ddf752b0..35cfe934493a7425e415d58834d4016b4ea31e3b 100644 +index 74e83b3d2e7e7c89ccba4b6aaf612f41800efe4e..d8cb7a53940c244b3ad36d32cdbbee1b3746e543 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -384,6 +384,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -377,7 +377,7 @@ index 2f5f8e084c30bf654a19582e0b7baa9cde1b99b5..4f7b12d8f213d43f4ef5538b7e05809a } } diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 2861c585710eaa00541ff417a29f1f6a2fb5b46a..417296e8d2efb2b70809ff91b61451bd8e788df3 100644 +index 65a95703bb842d5aeacb606842621198c8aab7ab..493ed4f58781c56a01a79ec4a8012528a357520d 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -1,39 +1,52 @@ @@ -740,8 +740,8 @@ index 2861c585710eaa00541ff417a29f1f6a2fb5b46a..417296e8d2efb2b70809ff91b61451bd + } // Add a little performance juice to active entities. Skip 1/4 if not immune. -- } else if ( !entity.defaultActivationState && entity.tickCount + entity.getId() + 1 % 4 == 0 && !ActivationRange.checkEntityImmunities( entity ) ) // Paper - Ensure checking item movement is offset from Spigot's entity activation range check -+ } else if ( entity.tickCount + entity.getId() + 1 % 4 == 0 && ActivationRange.checkEntityImmunities( entity ) < 0 ) // Paper +- } else if ( !entity.defaultActivationState && (entity.tickCount + entity.getId()) % 4 == 3 && !ActivationRange.checkEntityImmunities( entity ) ) // Paper - Ensure checking item movement is offset from Spigot's entity activation range check ++ } else if ( (entity.tickCount + entity.getId()) % 4 == 3 && ActivationRange.checkEntityImmunities( entity ) < 0 ) // Paper { isActive = false; }