/// <summary>
 /// 'Initiates construction of the Structure Component picked, at the current Location of StructGen'
 /// </summary>
 public override void BuildComponent(StructureComponent par1StructureComponent, List <StructureComponent> par2List, Random par3Random)
 {
     StructureVillagePieces.GetNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, BoundingBox.MinX - 1, BoundingBox.MaxY - 4, BoundingBox.MinZ + 1, 1, GetComponentType());
     StructureVillagePieces.GetNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, BoundingBox.MaxX + 1, BoundingBox.MaxY - 4, BoundingBox.MinZ + 1, 3, GetComponentType());
     StructureVillagePieces.GetNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, BoundingBox.MinX + 1, BoundingBox.MaxY - 4, BoundingBox.MinZ - 1, 2, GetComponentType());
     StructureVillagePieces.GetNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, BoundingBox.MinX + 1, BoundingBox.MaxY - 4, BoundingBox.MaxZ + 1, 0, GetComponentType());
 }
        public StructureVillageStart(World par1World, Random par2Random, int par3, int par4, int par5)
        {
            HasMoreThanTwoComponents = false;
            int i = par5;
            List <StructureVillagePieceWeight> arraylist = StructureVillagePieces.GetStructureVillageWeightedPieceList(par2Random, i);
            ComponentVillageStartPiece         componentvillagestartpiece = new ComponentVillageStartPiece(par1World.GetWorldChunkManager(), 0, par2Random, (par3 << 4) + 2, (par4 << 4) + 2, arraylist, i);

            Components.Add(componentvillagestartpiece);
            componentvillagestartpiece.BuildComponent(componentvillagestartpiece, Components, par2Random);
            List <StructureComponent> arraylist1 = componentvillagestartpiece.Field_35106_f;

            for (List <StructureComponent> arraylist2 = componentvillagestartpiece.Field_35108_e; arraylist1.Count > 0 || arraylist2.Count > 0;)
            {
                if (arraylist1.Count > 0)
                {
                    int j = par2Random.Next(arraylist1.Count);
                    StructureComponent structurecomponent = arraylist1[i];
                    arraylist1.RemoveAt(j);
                    structurecomponent.BuildComponent(componentvillagestartpiece, Components, par2Random);
                }
                else
                {
                    int k = par2Random.Next(arraylist2.Count);
                    StructureComponent structurecomponent1 = arraylist2[k];
                    arraylist2.RemoveAt(k);
                    structurecomponent1.BuildComponent(componentvillagestartpiece, Components, par2Random);
                }
            }

            UpdateBoundingBox();
            int l = 0;
            IEnumerator <StructureComponent> iterator = Components.GetEnumerator();

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

                StructureComponent structurecomponent2 = iterator.Current;

                if (!(structurecomponent2 is ComponentVillageRoadPiece))
                {
                    l++;
                }
            }while (true);

            HasMoreThanTwoComponents = l > 2;
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the next village component, with the bounding box shifted +1 in the X and Z direction.
        /// </summary>
        protected virtual StructureComponent GetNextComponentPP(ComponentVillageStartPiece par1ComponentVillageStartPiece, List <StructureComponent> par2List, Random par3Random, int par4, int par5)
        {
            switch (CoordBaseMode)
            {
            case 2:
                return(StructureVillagePieces.GetNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, BoundingBox.MaxX + 1, BoundingBox.MinY + par4, BoundingBox.MinZ + par5, 3, GetComponentType()));

            case 0:
                return(StructureVillagePieces.GetNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, BoundingBox.MaxX + 1, BoundingBox.MinY + par4, BoundingBox.MinZ + par5, 3, GetComponentType()));

            case 1:
                return(StructureVillagePieces.GetNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, BoundingBox.MinX + par5, BoundingBox.MinY + par4, BoundingBox.MaxZ + 1, 0, GetComponentType()));

            case 3:
                return(StructureVillagePieces.GetNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, BoundingBox.MinX + par5, BoundingBox.MinY + par4, BoundingBox.MaxZ + 1, 0, GetComponentType()));
            }

            return(null);
        }
        /// <summary>
        /// 'Initiates construction of the Structure Component picked, at the current Location of StructGen'
        /// </summary>
        public override void BuildComponent(StructureComponent par1StructureComponent, List <StructureComponent> par2List, Random par3Random)
        {
            bool flag = false;

            for (int i = par3Random.Next(5); i < AverageGroundLevel - 8; i += 2 + par3Random.Next(5))
            {
                StructureComponent structurecomponent = GetNextComponentNN((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, 0, i);

                if (structurecomponent != null)
                {
                    i   += Math.Max(structurecomponent.BoundingBox.GetXSize(), structurecomponent.BoundingBox.GetZSize());
                    flag = true;
                }
            }

            for (int j = par3Random.Next(5); j < AverageGroundLevel - 8; j += 2 + par3Random.Next(5))
            {
                StructureComponent structurecomponent1 = GetNextComponentPP((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, 0, j);

                if (structurecomponent1 != null)
                {
                    j   += Math.Max(structurecomponent1.BoundingBox.GetXSize(), structurecomponent1.BoundingBox.GetZSize());
                    flag = true;
                }
            }

            if (flag && par3Random.Next(3) > 0)
            {
                switch (CoordBaseMode)
                {
                case 2:
                    StructureVillagePieces.GetNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, BoundingBox.MinX - 1, BoundingBox.MinY, BoundingBox.MinZ, 1, GetComponentType());
                    break;

                case 0:
                    StructureVillagePieces.GetNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, BoundingBox.MinX - 1, BoundingBox.MinY, BoundingBox.MaxZ - 2, 1, GetComponentType());
                    break;

                case 3:
                    StructureVillagePieces.GetNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, BoundingBox.MaxX - 2, BoundingBox.MinY, BoundingBox.MinZ - 1, 2, GetComponentType());
                    break;

                case 1:
                    StructureVillagePieces.GetNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, BoundingBox.MinX, BoundingBox.MinY, BoundingBox.MinZ - 1, 2, GetComponentType());
                    break;
                }
            }

            if (flag && par3Random.Next(3) > 0)
            {
                switch (CoordBaseMode)
                {
                case 2:
                    StructureVillagePieces.GetNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, BoundingBox.MaxX + 1, BoundingBox.MinY, BoundingBox.MinZ, 3, GetComponentType());
                    break;

                case 0:
                    StructureVillagePieces.GetNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, BoundingBox.MaxX + 1, BoundingBox.MinY, BoundingBox.MaxZ - 2, 3, GetComponentType());
                    break;

                case 3:
                    StructureVillagePieces.GetNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, BoundingBox.MaxX - 2, BoundingBox.MinY, BoundingBox.MaxZ + 1, 0, GetComponentType());
                    break;

                case 1:
                    StructureVillagePieces.GetNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, BoundingBox.MinX, BoundingBox.MinY, BoundingBox.MaxZ + 1, 0, GetComponentType());
                    break;
                }
            }
        }