/// <summary>
        /// Returns whether the EntityAIBase should begin execution.
        /// </summary>
        public override bool ShouldExecute()
        {
            if (!TheEntity.IsCollidedHorizontally)
            {
                return(false);
            }

            PathNavigate pathnavigate = TheEntity.GetNavigator();
            PathEntity   pathentity   = pathnavigate.GetPath();

            if (pathentity == null || pathentity.IsFinished() || !pathnavigate.Func_48665_b())
            {
                return(false);
            }

            for (int i = 0; i < Math.Min(pathentity.GetCurrentPathIndex() + 2, pathentity.GetCurrentPathLength()); i++)
            {
                PathPoint pathpoint = pathentity.GetPathPointFromIndex(i);
                EntityPosX = pathpoint.XCoord;
                EntityPosY = pathpoint.YCoord + 1;
                EntityPosZ = pathpoint.ZCoord;

                if (TheEntity.GetDistanceSq(EntityPosX, TheEntity.PosY, EntityPosZ) > 2.25D)
                {
                    continue;
                }

                TargetDoor = Func_48318_a(EntityPosX, EntityPosY, EntityPosZ);

                if (TargetDoor != null)
                {
                    return(true);
                }
            }

            EntityPosX = MathHelper2.Floor_double(TheEntity.PosX);
            EntityPosY = MathHelper2.Floor_double(TheEntity.PosY + 1.0D);
            EntityPosZ = MathHelper2.Floor_double(TheEntity.PosZ);
            TargetDoor = Func_48318_a(EntityPosX, EntityPosY, EntityPosZ);
            return(TargetDoor != null);
        }
        private void PathFollow()
        {
            Vec3D vec3d = GetEntityPosition();
            int   i     = CurrentPath.GetCurrentPathLength();
            int   i2    = CurrentPath.GetCurrentPathIndex();

            do
            {
                if (i2 >= CurrentPath.GetCurrentPathLength())
                {
                    break;
                }

                if (CurrentPath.GetPathPointFromIndex(i2).YCoord != (int)vec3d.YCoord)
                {
                    i = i2;
                    break;
                }

                i2++;
            }while (true);

            float f = TheEntity.Width * TheEntity.Width;

            for (int j = CurrentPath.GetCurrentPathIndex(); j < i; j++)
            {
                if (vec3d.SquareDistanceTo(CurrentPath.GetVectorFromIndex(TheEntity, j)) < (double)f)
                {
                    CurrentPath.SetCurrentPathIndex(j + 1);
                }
            }

            int k  = (int)Math.Ceiling(TheEntity.Width);
            int l  = (int)TheEntity.Height + 1;
            int i1 = k;
            int j1 = i - 1;

            do
            {
                if (j1 < CurrentPath.GetCurrentPathIndex())
                {
                    break;
                }

                if (IsDirectPathBetweenPoints(vec3d, CurrentPath.GetVectorFromIndex(TheEntity, j1), k, l, i1))
                {
                    CurrentPath.SetCurrentPathIndex(j1);
                    break;
                }

                j1--;
            }while (true);

            if (TotalTicks - TicksAtLastPos > 100)
            {
                if (vec3d.SquareDistanceTo(LastPosCheck) < 2.25D)
                {
                    ClearPathEntity();
                }

                TicksAtLastPos      = TotalTicks;
                LastPosCheck.XCoord = vec3d.XCoord;
                LastPosCheck.YCoord = vec3d.YCoord;
                LastPosCheck.ZCoord = vec3d.ZCoord;
            }
        }