Ejemplo n.º 1
0
        protected override bool CanSpawnStructureAtCoords(int par1, int par2)
        {
            if (!RanBiomeCheck)
            {
                Random random = new Random();
                random.SetSeed((int)WorldObj.GetSeed());
                double d = random.NextDouble() * Math.PI * 2D;

                for (int k = 0; k < StructureCoords.Length; k++)
                {
                    double d1 = (1.25D + random.NextDouble()) * 32D;
                    int    l  = (int)Math.Round(Math.Cos(d) * d1);
                    int    i1 = (int)Math.Round(Math.Sin(d) * d1);
                    List <BiomeGenBase> arraylist     = new List <BiomeGenBase>();
                    BiomeGenBase[]      abiomegenbase = AllowedBiomeGenBases;
                    int j1 = abiomegenbase.Length;

                    for (int k1 = 0; k1 < j1; k1++)
                    {
                        BiomeGenBase biomegenbase = abiomegenbase[k1];
                        arraylist.Add(biomegenbase);
                    }

                    ChunkPosition chunkposition = WorldObj.GetWorldChunkManager().FindBiomePosition((l << 4) + 8, (i1 << 4) + 8, 112, arraylist, random);

                    if (chunkposition != null)
                    {
                        l  = chunkposition.x >> 4;
                        i1 = chunkposition.z >> 4;
                    }
                    else
                    {
                        Console.WriteLine((new StringBuilder()).Append("Placed stronghold in INVALID biome at (").Append(l).Append(", ").Append(i1).Append(")").ToString());
                    }

                    StructureCoords[k] = new ChunkCoordIntPair(l, i1);
                    d += (Math.PI * 2D) / (double)StructureCoords.Length;
                }

                RanBiomeCheck = true;
            }

            ChunkCoordIntPair[] achunkcoordintpair = StructureCoords;
            int i = achunkcoordintpair.Length;

            for (int j = 0; j < i; j++)
            {
                ChunkCoordIntPair chunkcoordintpair = achunkcoordintpair[j];

                if (par1 == chunkcoordintpair.ChunkXPos && par2 == chunkcoordintpair.ChunkZPos)
                {
                    Console.WriteLine((new StringBuilder()).Append(par1).Append(", ").Append(par2).ToString());
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        protected override bool CanSpawnStructureAtCoords(int par1, int par2)
        {
            int i = par1 >> 4;
            int j = par2 >> 4;

            Rand.SetSeed((i ^ j << 4) ^ (int)WorldObj.GetSeed());
            Rand.Next();

            if (Rand.Next(3) != 0)
            {
                return(false);
            }

            if (par1 != (i << 4) + 4 + Rand.Next(8))
            {
                return(false);
            }

            return(par2 == (j << 4) + 4 + Rand.Next(8));
        }
 /// <summary>
 /// Returns the chunk provider back for the world provider
 /// </summary>
 public override IChunkProvider GetChunkProvider()
 {
     return(new ChunkProviderHell(WorldObj, WorldObj.GetSeed()));
 }
Ejemplo n.º 4
0
 public override Random GetRandomWithSeed(long par1)
 {
     return(new Random((int)WorldObj.GetSeed() + (XPosition * XPosition * 0x4c1906) + (XPosition * 0x5ac0db) + (ZPosition * ZPosition) * 0x4307a7 + (ZPosition * 0x5f24f) ^ (int)par1));
 }