mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
422cd8d65d
EAR 2 evaluates the entities activity on the already incremented entity tick. This diverges from spigots behaviour and hence needed adoption for their item ear fix.
48 lines
2.7 KiB
Diff
48 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Nassim Jahnke <nassim@njahnke.dev>
|
|
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
|
@@ -0,0 +0,0 @@ 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;
|
|
}
|
|
|
|
@@ -0,0 +0,0 @@ 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;
|
|
}
|
|
}
|