aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0302-Fix-item-EAR-ticks.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2024-10-30 14:06:43 +0100
committerNassim Jahnke <[email protected]>2024-10-30 14:06:43 +0100
commit9f1fa0b4f8ea807b0adab45660b1ad8f89f267ef (patch)
tree52b9442280ca9878bb43b599fb5441dad3cf35e3 /patches/server/0302-Fix-item-EAR-ticks.patch
parentfe2f3d46933c9f3dc0e4bda238e5af34b01d2a48 (diff)
downloadPaper-9f1fa0b4f8ea807b0adab45660b1ad8f89f267ef.tar.gz
Paper-9f1fa0b4f8ea807b0adab45660b1ad8f89f267ef.zip
Fix item gravity on inactive items, remove dumb active skipping
Diffstat (limited to 'patches/server/0302-Fix-item-EAR-ticks.patch')
-rw-r--r--patches/server/0302-Fix-item-EAR-ticks.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/patches/server/0302-Fix-item-EAR-ticks.patch b/patches/server/0302-Fix-item-EAR-ticks.patch
new file mode 100644
index 0000000000..8fd577191b
--- /dev/null
+++ b/patches/server/0302-Fix-item-EAR-ticks.patch
@@ -0,0 +1,42 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Nassim Jahnke <[email protected]>
+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.
+
+diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+index 75ebf09777e19645eee296a9edabac39c858ffb9..c21fa55c62d97d9511e41a1e313e904330a6eee6 100644
+--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
++++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+@@ -175,7 +175,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
+ }
+ }
+
+- 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;
+diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
+index dd1c5bc7522a4710cbfdd4764f6431e1e28d63cc..05ad15fc40ccb7feed5c51ad0ad0a98bd0d02af6 100644
+--- a/src/main/java/org/spigotmc/ActivationRange.java
++++ b/src/main/java/org/spigotmc/ActivationRange.java
+@@ -251,12 +251,11 @@ public class ActivationRange
+ entity.activatedTick = MinecraftServer.currentTick + 20;
+ }
+ isActive = true;
++ } else if (entity instanceof net.minecraft.world.entity.item.ItemEntity && (entity.tickCount + entity.getId()) % 4 == 0) { // Paper - Needed for item gravity, see ItemEntity tick
++ 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;
+ }
+ }