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

            if (VillagerObj.GetRNG().Next(500) != 0)
            {
                return(false);
            }

            VillageObj = WorldObj.VillageCollectionObj.FindNearestVillage(MathHelper2.Floor_double(VillagerObj.PosX), MathHelper2.Floor_double(VillagerObj.PosY), MathHelper2.Floor_double(VillagerObj.PosZ), 0);

            if (VillageObj == null)
            {
                return(false);
            }

            if (!CheckSufficientDoorsPresentForNewVillager())
            {
                return(false);
            }

            Entity entity = WorldObj.FindNearestEntityWithinAABB(typeof(net.minecraft.src.EntityVillager), VillagerObj.BoundingBox.Expand(8, 3, 8), VillagerObj);

            if (entity == null)
            {
                return(false);
            }

            Mate = (EntityVillager)entity;
            return(Mate.GetGrowingAge() == 0);
        }
Пример #2
0
        /// <summary>
        /// Returns whether the EntityAIBase should begin execution.
        /// </summary>
        public override bool ShouldExecute()
        {
            if (VillagerObj.GetGrowingAge() >= 0)
            {
                return(false);
            }

            if (VillagerObj.GetRNG().Next(400) != 0)
            {
                return(false);
            }

            List <Entity>        list     = VillagerObj.WorldObj.GetEntitiesWithinAABB(typeof(net.minecraft.src.EntityVillager), VillagerObj.BoundingBox.Expand(6, 3, 6));
            double               d        = double.MaxValue;
            IEnumerator <Entity> iterator = list.GetEnumerator();

            do
            {
                if (!iterator.MoveNext())
                {
                    break;
                }

                Entity entity = iterator.Current;

                if (entity != VillagerObj)
                {
                    EntityVillager entityvillager = (EntityVillager)entity;

                    if (!entityvillager.GetIsPlayingFlag() && entityvillager.GetGrowingAge() < 0)
                    {
                        double d1 = entityvillager.GetDistanceSqToEntity(VillagerObj);

                        if (d1 <= d)
                        {
                            d = d1;
                            TargetVillager = entityvillager;
                        }
                    }
                }
            }while (true);

            if (TargetVillager == null)
            {
                Vec3D vec3d = RandomPositionGenerator.Func_48622_a(VillagerObj, 16, 3);

                if (vec3d == null)
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #3
0
        protected virtual void Func_40292_b(EntityVillager par1EntityVillager, float par2)
        {
            float f = 0.9375F;

            if (par1EntityVillager.GetGrowingAge() < 0)
            {
                f          = (float)((double)f * 0.5D);
                ShadowSize = 0.25F;
            }
            else
            {
                ShadowSize = 0.5F;
            }

            //GL.Scale(f, f, f);
        }
        /// <summary>
        /// Returns whether the EntityAIBase should begin execution.
        /// </summary>
        public override bool ShouldExecute()
        {
            if (TheVillager.GetGrowingAge() >= 0)
            {
                return(false);
            }

            if (!TheVillager.WorldObj.IsDaytime())
            {
                return(false);
            }

            List <Entity> list = TheVillager.WorldObj.GetEntitiesWithinAABB(typeof(net.minecraft.src.EntityIronGolem), TheVillager.BoundingBox.Expand(6, 2, 6));

            if (list.Count == 0)
            {
                return(false);
            }

            IEnumerator <Entity> iterator = list.GetEnumerator();

            do
            {
                if (!iterator.MoveNext())
                {
                    break;
                }

                Entity          entity          = iterator.Current;
                EntityIronGolem entityirongolem = (EntityIronGolem)entity;

                if (entityirongolem.Func_48117_D_() <= 0)
                {
                    continue;
                }

                TheGolem = entityirongolem;
                break;
            }while (true);

            return(TheGolem != null);
        }