Ejemplo n.º 1
0
        /// <summary>
        /// Spawns a number of villagers in this component. Parameters: world, component bounding box, x offset, y offset, z
        /// offset, number of villagers
        /// </summary>
        protected virtual void SpawnVillagers(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6)
        {
            if (VillagersSpawned >= par6)
            {
                return;
            }

            int i = VillagersSpawned;

            do
            {
                if (i >= par6)
                {
                    break;
                }

                int j = GetXWithOffset(par3 + i, par5);
                int k = GetYWithOffset(par4);
                int l = GetZWithOffset(par3 + i, par5);

                if (!par2StructureBoundingBox.IsVecInside(j, k, l))
                {
                    break;
                }

                VillagersSpawned++;
                EntityVillager entityvillager = new EntityVillager(par1World, GetVillagerType(i));
                entityvillager.SetLocationAndAngles(j + 0.5F, k, l + 0.5F, 0.0F, 0.0F);
                par1World.SpawnEntityInWorld(entityvillager);
                i++;
            }while (true);
        }
        /// <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);
        }
 public EntityAIVillagerMate(EntityVillager par1EntityVillager)
 {
     MatingTimeout = 0;
     VillagerObj   = par1EntityVillager;
     WorldObj      = par1EntityVillager.WorldObj;
     SetMutexBits(3);
 }
Ejemplo n.º 4
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);
        }
        private void GiveBirth()
        {
            EntityVillager entityvillager = new EntityVillager(WorldObj);

            Mate.SetGrowingAge(6000);
            VillagerObj.SetGrowingAge(6000);
            entityvillager.SetGrowingAge(-24000);
            entityvillager.SetProfession(VillagerObj.GetRNG().Next(5));
            entityvillager.SetLocationAndAngles(VillagerObj.PosX, VillagerObj.PosY, VillagerObj.PosZ, 0.0F, 0.0F);
            WorldObj.SpawnEntityInWorld(entityvillager);
            SpawnHeartParticles(entityvillager);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
 public EntityAIPlay(EntityVillager par1EntityVillager, float par2)
 {
     VillagerObj   = par1EntityVillager;
     Field_48358_c = par2;
     SetMutexBits(1);
 }
Ejemplo n.º 8
0
 protected virtual void Func_40291_a(EntityVillager par1EntityVillager, float par2)
 {
     base.RenderEquippedItems(par1EntityVillager, par2);
 }
Ejemplo n.º 9
0
 protected virtual void Func_40290_a(EntityVillager entityvillager, double d, double d1, double d2)
 {
 }
Ejemplo n.º 10
0
 public virtual void DoRenderVillager(EntityVillager par1EntityVillager, double par2, double par4, double par6, float par8, float par9)
 {
     base.DoRenderLiving(par1EntityVillager, par2, par4, par6, par8, par9);
 }
Ejemplo n.º 11
0
 protected virtual int Func_40293_a(EntityVillager par1EntityVillager, int par2, float par3)
 {
     return(-1);
 }
 public EntityAIFollowGolem(EntityVillager par1EntityVillager)
 {
     Field_48400_d = false;
     TheVillager   = par1EntityVillager;
     SetMutexBits(3);
 }
 /// <summary>
 /// Resets the task
 /// </summary>
 public override void ResetTask()
 {
     VillageObj = null;
     Mate       = null;
     VillagerObj.SetIsMatingFlag(false);
 }