Paper/CraftBukkit-Patches/0020-Reduce-number-of-LivingEntity-collision-checks.patch
Aikar e9950b70d3 Overhaul to Timings and Entity Activation Range
This greatly extends the timings improvements I've done in recent commits, and brings timings to fully cover the entire tick.
The timings system also now tracks when specific timings causes the server to lose TPS.
The timings are also able to be turned on "on demand", meaning you do not need to restart the server to enable them.

This commit also overhauls the Entity Activation Range feature, fixing bugs, adding more immunities, and improving the performance of it.
It also fixes a regression with a recent Spigot commit that broke the entire Entity Activation Range feature.

This commit had to move the Tick Loop patch before timings because there was a change done there to time the entire tick, so lots of renames.

These 2 commits had to be bundled together to simplify applying them and reduce redundant conflict resolution.
2013-02-27 07:29:33 +11:00

38 lines
1.3 KiB
Diff

From a9525c7ac96f2692c584fcbd9c6469271e226364 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 18 Jan 2013 19:31:14 -0500
Subject: [PATCH] Reduce number of LivingEntity collision checks.
---
src/main/java/net/minecraft/server/EntityLiving.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index bd1aeaa..01b16ac 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1391,12 +1391,20 @@ public abstract class EntityLiving extends Entity {
}
protected void bd() {
+ // Spigot start
+ boolean skip = false;
+ if (!(this instanceof EntityPlayer) && this.ticksLived % 2 != 0) {
+ skip = true;
+ }
+ // Spigot end
+
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
if (list != null && !list.isEmpty()) {
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
+ if (entity instanceof EntityLiving && skip) { continue; } // Spigot
if (entity.M()) {
this.o(entity);
}
--
1.8.1.1