private bool CheckSufficientDoorsPresentForNewVillager()
        {
            int i = (int)((double)(float)VillageObj.GetNumVillageDoors() * 0.34999999999999998D);

            return(VillageObj.GetNumVillagers() < i);
        }
예제 #2
0
        private bool Func_48574_b()
        {
            List <EntityPlayer> list = Field_48582_a.PlayerEntities;

            for (IEnumerator <EntityPlayer> iterator = list.GetEnumerator(); iterator.MoveNext();)
            {
                EntityPlayer entityplayer = iterator.Current;
                Field_48576_f = Field_48582_a.VillageCollectionObj.FindNearestVillage((int)entityplayer.PosX, (int)entityplayer.PosY, (int)entityplayer.PosZ, 1);

                if (Field_48576_f != null && Field_48576_f.GetNumVillageDoors() >= 10 && Field_48576_f.GetTicksSinceLastDoorAdding() >= 20 && Field_48576_f.GetNumVillagers() >= 20)
                {
                    ChunkCoordinates chunkcoordinates = Field_48576_f.GetCenter();
                    float            f    = Field_48576_f.GetVillageRadius();
                    bool             flag = false;
                    int i = 0;

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

                        Field_48577_g = chunkcoordinates.PosX + (int)((double)(MathHelper2.Cos(Field_48582_a.Rand.NextFloat() * (float)Math.PI * 2.0F) * f) * 0.90000000000000002D);
                        Field_48583_h = chunkcoordinates.PosY;
                        Field_48584_i = chunkcoordinates.PosZ + (int)((double)(MathHelper2.Sin(Field_48582_a.Rand.NextFloat() * (float)Math.PI * 2.0F) * f) * 0.90000000000000002D);
                        flag          = false;
                        IEnumerator <Village> iterator1 = Field_48582_a.VillageCollectionObj.Func_48554_b().GetEnumerator();

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

                            Village village = iterator1.Current;

                            if (village == Field_48576_f || !village.IsInRange(Field_48577_g, Field_48583_h, Field_48584_i))
                            {
                                continue;
                            }

                            flag = true;
                            break;
                        }while (true);

                        if (!flag)
                        {
                            break;
                        }

                        i++;
                    }while (true);

                    if (flag)
                    {
                        return(false);
                    }

                    Vec3D vec3d = Func_48572_a(Field_48577_g, Field_48583_h, Field_48584_i);

                    if (vec3d != null)
                    {
                        Field_48579_e = 0;
                        Field_48578_d = 20;
                        return(true);
                    }
                }
            }

            return(false);
        }