From 17af62c89868c3eae05ed1f919e0d470132d45f5 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 22 Jan 2013 10:04:57 +1100 Subject: [PATCH] Reduce number of collision checks for living entities. --- ...ber-of-LivingEntity-collision-checks.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 CraftBukkit-Patches/0023-Reduce-number-of-LivingEntity-collision-checks.patch diff --git a/CraftBukkit-Patches/0023-Reduce-number-of-LivingEntity-collision-checks.patch b/CraftBukkit-Patches/0023-Reduce-number-of-LivingEntity-collision-checks.patch new file mode 100644 index 000000000..e78d3af7a --- /dev/null +++ b/CraftBukkit-Patches/0023-Reduce-number-of-LivingEntity-collision-checks.patch @@ -0,0 +1,37 @@ +From 2e2b7c86482c38d4c37f1df77509bca28655cb63 Mon Sep 17 00:00:00 2001 +From: Aikar +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 b2481aa..e476393 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -1402,12 +1402,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 EntityMinecart) && skip) { continue; } // Spigot + if (entity.M()) { + this.o(entity); + } +-- +1.8.1-rc2 +