示例#1
0
		public StructureStrongholdStart(World par1World, Random par2Random, int par3, int par4)
		{
			StructureStrongholdPieces.PrepareStructurePieces();
			ComponentStrongholdStairs2 componentstrongholdstairs2 = new ComponentStrongholdStairs2(0, par2Random, (par3 << 4) + 2, (par4 << 4) + 2);
			Components.Add(componentstrongholdstairs2);
			componentstrongholdstairs2.BuildComponent(componentstrongholdstairs2, Components, par2Random);
			StructureComponent structurecomponent;

            for (List<StructureComponent> arraylist = componentstrongholdstairs2.Field_35037_b; arraylist.Count > 0; structurecomponent.BuildComponent(componentstrongholdstairs2, Components, par2Random))
			{
				int i = par2Random.Next(arraylist.Count);
                structurecomponent = arraylist[i];
                arraylist.RemoveAt(i);
			}

			UpdateBoundingBox();
			MarkAvailableHeight(par1World, par2Random, 10);
		}
示例#2
0
        /// <summary>
        /// Gets the next component in any cardinal direction
        /// </summary>
        protected virtual StructureComponent GetNextComponentNormal(ComponentStrongholdStairs2 par1ComponentStrongholdStairs2, List <StructureComponent> par2List, Random par3Random, int par4, int par5)
        {
            switch (CoordBaseMode)
            {
            case 2:
                return(StructureStrongholdPieces.GetNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, BoundingBox.MinX + par4, BoundingBox.MinY + par5, BoundingBox.MinZ - 1, CoordBaseMode, GetComponentType()));

            case 0:
                return(StructureStrongholdPieces.GetNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, BoundingBox.MinX + par4, BoundingBox.MinY + par5, BoundingBox.MaxZ + 1, CoordBaseMode, GetComponentType()));

            case 1:
                return(StructureStrongholdPieces.GetNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, BoundingBox.MinX - 1, BoundingBox.MinY + par5, BoundingBox.MinZ + par4, CoordBaseMode, GetComponentType()));

            case 3:
                return(StructureStrongholdPieces.GetNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, BoundingBox.MaxX + 1, BoundingBox.MinY + par5, BoundingBox.MinZ + par4, CoordBaseMode, GetComponentType()));
            }

            return(null);
        }
        private static StructureComponent GetNextValidComponent(ComponentStrongholdStairs2 par0ComponentStrongholdStairs2, List <StructureComponent> par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7)
        {
            if (par7 > 50)
            {
                return(null);
            }

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

            ComponentStronghold componentstronghold = GetNextComponent(par0ComponentStrongholdStairs2, par1List, par2Random, par3, par4, par5, par6, par7 + 1);

            if (componentstronghold != null)
            {
                par1List.Add(componentstronghold);
                par0ComponentStrongholdStairs2.Field_35037_b.Add(componentstronghold);
            }

            return(componentstronghold);
        }
 public static StructureComponent GetNextValidComponentAccess(ComponentStrongholdStairs2 par0ComponentStrongholdStairs2, List <StructureComponent> par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7)
 {
     return(GetNextValidComponent(par0ComponentStrongholdStairs2, par1List, par2Random, par3, par4, par5, par6, par7));
 }
        private static ComponentStronghold GetNextComponent(ComponentStrongholdStairs2 par0ComponentStrongholdStairs2, List <StructureComponent> par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7)
        {
            if (!CanAddStructurePieces())
            {
                return(null);
            }
            else
            {
                if (StrongComponentType != null)
                {
                    ComponentStronghold var8 = GetStrongholdComponentFromWeightedPiece(StrongComponentType, par1List, par2Random, par3, par4, par5, par6, par7);
                    StrongComponentType = null;

                    if (var8 != null)
                    {
                        return(var8);
                    }
                }

                int var13 = 0;

                while (var13 < 5)
                {
                    ++var13;
                    int var9 = par2Random.Next(TotalWeight);
                    IEnumerator <StructureStrongholdPieceWeight> var10 = StructurePieceList.GetEnumerator();

                    while (var10.MoveNext())
                    {
                        StructureStrongholdPieceWeight var11 = var10.Current;
                        var9 -= var11.PieceWeight;

                        if (var9 < 0)
                        {
                            if (!var11.CanSpawnMoreStructuresOfType(par7) || var11 == par0ComponentStrongholdStairs2.Field_35038_a)
                            {
                                break;
                            }

                            ComponentStronghold var12 = GetStrongholdComponentFromWeightedPiece(var11.PieceClass, par1List, par2Random, par3, par4, par5, par6, par7);

                            if (var12 != null)
                            {
                                ++var11.InstancesSpawned;
                                par0ComponentStrongholdStairs2.Field_35038_a = var11;

                                if (!var11.CanSpawnMoreStructures())
                                {
                                    StructurePieceList.Remove(var11);
                                }

                                return(var12);
                            }
                        }
                    }
                }

                StructureBoundingBox var14 = ComponentStrongholdCorridor.Func_35051_a(par1List, par2Random, par3, par4, par5, par6);

                if (var14 != null && var14.MinY > 1)
                {
                    return(new ComponentStrongholdCorridor(par7, par2Random, var14, par6));
                }
                else
                {
                    return(null);
                }
            }
        }