From 8a2c2db2a57003f5087af7014e2906a41aa9dd8e Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 30 Oct 2024 13:51:54 +0100 Subject: [PATCH] Fix item EAR ticks Item entities only have their gravity ticked every 4 ticks when on ground. Fix that and also remove Spigot's arbitrary tick skipping. It's a terribly cheap way of getting extra performance that doesn't really work at all. --- .../minecraft/world/entity/item/ItemEntity.java.patch | 9 +++++++++ .../src/main/java/org/spigotmc/ActivationRange.java | 7 ++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch index 4d20f4a8d9..219788780e 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch @@ -84,6 +84,15 @@ this.xo = this.getX(); this.yo = this.getY(); +@@ -162,7 +175,7 @@ + } + } + +- if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { ++ if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { // Paper - Diff on change; ActivationRange immunity + this.move(MoverType.SELF, this.getDeltaMovement()); + this.applyEffectsFromBlocks(); + float f = 0.98F; @@ -188,9 +201,11 @@ this.mergeWithNeighbours(); } diff --git a/paper-server/src/main/java/org/spigotmc/ActivationRange.java b/paper-server/src/main/java/org/spigotmc/ActivationRange.java index 3184090cfa..34297951d3 100644 --- a/paper-server/src/main/java/org/spigotmc/ActivationRange.java +++ b/paper-server/src/main/java/org/spigotmc/ActivationRange.java @@ -234,7 +234,7 @@ public class ActivationRange public static boolean checkIfActive(Entity entity) { // Never safe to skip fireworks or item gravity - if (entity instanceof FireworkRocketEntity || (entity instanceof ItemEntity && (entity.tickCount + entity.getId() + 1) % 4 == 0)) { + if (entity instanceof FireworkRocketEntity || (entity instanceof ItemEntity && (entity.tickCount + entity.getId()) % 4 == 0)) { // Paper - Needed for item gravity, see ItemEntity tick return true; } @@ -253,11 +253,8 @@ public class ActivationRange } isActive = true; } - // 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 ) ) - { - isActive = false; } + // Paper - remove dumb tick skipping for active entities return isActive; } }