예제 #1
0
        private static StructureComponent GetNextComponentVillagePath(ComponentVillageStartPiece par0ComponentVillageStartPiece, List <StructureComponent> par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7)
        {
            if (par7 > 3 + par0ComponentVillageStartPiece.TerrainType)
            {
                return(null);
            }

            if (Math.Abs(par3 - par0ComponentVillageStartPiece.GetBoundingBox().MinX) > 112 || Math.Abs(par5 - par0ComponentVillageStartPiece.GetBoundingBox().MinZ) > 112)
            {
                return(null);
            }

            StructureBoundingBox structureboundingbox = ComponentVillagePathGen.Func_35087_a(par0ComponentVillageStartPiece, par1List, par2Random, par3, par4, par5, par6);

            if (structureboundingbox != null && structureboundingbox.MinY > 10)
            {
                ComponentVillagePathGen componentvillagepathgen = new ComponentVillagePathGen(par7, par2Random, structureboundingbox, par6);
                int i  = (((StructureComponent)(componentvillagepathgen)).BoundingBox.MinX + ((StructureComponent)(componentvillagepathgen)).BoundingBox.MaxX) / 2;
                int j  = (((StructureComponent)(componentvillagepathgen)).BoundingBox.MinZ + ((StructureComponent)(componentvillagepathgen)).BoundingBox.MaxZ) / 2;
                int k  = ((StructureComponent)(componentvillagepathgen)).BoundingBox.MaxX - ((StructureComponent)(componentvillagepathgen)).BoundingBox.MinX;
                int l  = ((StructureComponent)(componentvillagepathgen)).BoundingBox.MaxZ - ((StructureComponent)(componentvillagepathgen)).BoundingBox.MinZ;
                int i1 = k <= l ? l : k;

                if (par0ComponentVillageStartPiece.GetWorldChunkManager().AreBiomesViable(i, j, i1 / 2 + 4, MapGenVillage.VillageSpawnBiomes))
                {
                    par1List.Add(componentvillagepathgen);
                    par0ComponentVillageStartPiece.Field_35106_f.Add(componentvillagepathgen);
                    return(componentvillagepathgen);
                }
            }

            return(null);
        }
예제 #2
0
        /// <summary>
        /// 'attempts to find a next Structure Component to be spawned, private Village function'
        /// </summary>
        private static StructureComponent GetNextVillageStructureComponent(ComponentVillageStartPiece par0ComponentVillageStartPiece, List <StructureComponent> par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7)
        {
            if (par7 > 50)
            {
                return(null);
            }

            if (Math.Abs(par3 - par0ComponentVillageStartPiece.GetBoundingBox().MinX) > 112 || Math.Abs(par5 - par0ComponentVillageStartPiece.GetBoundingBox().MinZ) > 112)
            {
                return(null);
            }

            ComponentVillage componentvillage = GetNextVillageComponent(par0ComponentVillageStartPiece, par1List, par2Random, par3, par4, par5, par6, par7 + 1);

            if (componentvillage != null)
            {
                int i  = (((StructureComponent)(componentvillage)).BoundingBox.MinX + ((StructureComponent)(componentvillage)).BoundingBox.MaxX) / 2;
                int j  = (((StructureComponent)(componentvillage)).BoundingBox.MinZ + ((StructureComponent)(componentvillage)).BoundingBox.MaxZ) / 2;
                int k  = ((StructureComponent)(componentvillage)).BoundingBox.MaxX - ((StructureComponent)(componentvillage)).BoundingBox.MinX;
                int l  = ((StructureComponent)(componentvillage)).BoundingBox.MaxZ - ((StructureComponent)(componentvillage)).BoundingBox.MinZ;
                int i1 = k <= l ? l : k;

                if (par0ComponentVillageStartPiece.GetWorldChunkManager().AreBiomesViable(i, j, i1 / 2 + 4, MapGenVillage.VillageSpawnBiomes))
                {
                    par1List.Add(componentvillage);
                    par0ComponentVillageStartPiece.Field_35108_e.Add(componentvillage);
                    return(componentvillage);
                }
            }

            return(null);
        }