protected void generateSpawnPoint()
    {
        if (!this.worldProvider.canRespawnHere())
        {
            this.worldInfo.setSpawnPosition(0, this.worldProvider.getAverageGroundLevel(), 0);
        }
        else
        {
            this.findingSpawnPoint = true;
            WorldChunkManager var1 = this.worldProvider.worldChunkMgr;
            List var2 = var1.getBiomesToSpawnIn();
            Random var3 = new Random(this.getSeed());
            ChunkPosition var4 = var1.findBiomePosition(0, 0, 256, var2, var3);
            int var5 = 0;
            int var6 = this.worldProvider.getAverageGroundLevel();
            int var7 = 0;

            if (var4 != null)
            {
                var5 = var4.x;
                var7 = var4.z;
            }
            else
            {
                System.out.println("Unable to find spawn biome");
            }

            int var8 = 0;

            while (!this.worldProvider.canCoordinateBeSpawn(var5, var7))
            {
                var5 += var3.nextInt(64) - var3.nextInt(64);
                var7 += var3.nextInt(64) - var3.nextInt(64);
                ++var8;

                if (var8 == 1000)
                {
                    break;
                }
            }

            this.worldInfo.setSpawnPosition(var5, var6, var7);
            this.findingSpawnPoint = false;
        }
    }