Fix operator precedence bug (#8756)

This commit is contained in:
Hannes Greule 2023-01-03 14:42:58 +01:00 committed by GitHub
parent 51cfcc88da
commit de5b1da681
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -28,7 +28,7 @@ index 02bd99934066b35a3f4fd59370cdabf0640ee218..477c9358a09067ace4d0fe3f519148fe
float f1 = 0.98F; float f1 = 0.98F;
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java 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 --- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -257,7 +257,7 @@ public class ActivationRange @@ -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. // 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 % 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; isActive = false;
} }

View file

@ -112,7 +112,7 @@ index f85cbcd0ba398bdd2622a2e1aaba7de24d53038a..3b528a6adaa431ebdf11ce2ce8ea3c99
} else { } else {
passenger.stopRiding(); passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java 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 --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/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 { @@ -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 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 --- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -1,39 +1,52 @@ @@ -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. // 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.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() + 1 % 4 == 0 && ActivationRange.checkEntityImmunities( entity ) < 0 ) // Paper + } else if ( (entity.tickCount + entity.getId()) % 4 == 3 && ActivationRange.checkEntityImmunities( entity ) < 0 ) // Paper
{ {
isActive = false; isActive = false;
} }