From 9973e7cdec6e8417d99cc75d116b46ce0d6b0c53 Mon Sep 17 00:00:00 2001
From: Travis Watkins <amaranth@ubuntu.com>
Date: Fri, 7 Dec 2012 21:18:51 -0600
Subject: [PATCH] Update entity state correctly when marked as persistent.
 Fixes BUKKIT-3123

When a mob is marked with the persistent flag (animal or anything with
setRemoveWhenFarAway(false)) the entire block of code for checking if they
should be despawned is skipped. However, one part of this code updates the
mob state if a player is close enough to them. It turns out this state is
used by the AI system to decide if the mob should move around randomly or
not. To stop mobs from being frozen in place we now update this state if
the persistent flag is set as well.
---
 src/main/java/net/minecraft/server/EntityLiving.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index ba9721c480..c36c25b235 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1413,7 +1413,11 @@ public abstract class EntityLiving extends Entity {
                     this.bA = 0;
                 }
             }
+        // CraftBukkit start
+        } else {
+            this.bA = 0;
         }
+        // CraftBukkit end
     }
 
     protected void bl() {