Paper/CraftBukkit-Patches/0018-Reduce-number-of-LivingEntity-collision-checks.patch
2013-04-10 14:08:33 +10:00

35 lines
1.2 KiB
Diff

From d55bf0e93b31f79467195af477860b32dba05a1e 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.
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 14854ac..322e37f 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1430,12 +1430,20 @@ public abstract class EntityLiving extends Entity {
}
protected void bg() {
+ // 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.L()) {
this.o(entity);
}
--
1.8.2.1