Esempio n. 1
0
        public ChunkPosition func_35139_a(int i, int j, int k, List <BiomeGenBase> list, java.util.Random random)
        {
            int l  = i - k >> 2;
            int i1 = j - k >> 2;
            int j1 = i + k >> 2;
            int k1 = j + k >> 2;
            int l1 = (j1 - l) + 1;
            int i2 = (k1 - i1) + 1;

            int[]         ai            = field_34907_a.func_35018_a(l, i1, l1, i2);
            ChunkPosition chunkposition = null;
            int           j2            = 0;

            for (int k2 = 0; k2 < ai.Length; k2++)
            {
                int          l2           = l + k2 % l1 << 2;
                int          i3           = i1 + k2 / l1 << 2;
                BiomeGenBase biomegenbase = BiomeGenBase.biomeList[ai[k2]];
                if (list.Contains(biomegenbase) && (chunkposition == null || random.nextInt(j2 + 1) == 0))
                {
                    chunkposition = new ChunkPosition(l2, 0, i3);
                    j2++;
                }
            }

            return(chunkposition);
        }
Esempio n. 2
0
    /**
     * Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length.
     */
    public float[] getRainfall(float[] listToReuse, int x, int z, int width, int length)
    {
        IntCache.resetIntCache();

        if (listToReuse == null || listToReuse.Length < width * length)
        {
            listToReuse = new float[width * length];
        }

        int[] aint = this.biomeIndexLayer.getInts(x, z, width, length);

        for (int i = 0; i < width * length; ++i)
        {
            float f = (float)BiomeGenBase.getBiomeFromBiomeList(aint [i], BiomeGenBase.field_180279_ad).getIntRainfall() / 65536.0F;

            if (f > 1.0F)
            {
                f = 1.0F;
            }

            listToReuse [i] = f;
        }

        return(listToReuse);
    }
Esempio n. 3
0
    /**
     * Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false,
     * don't check biomeCache to avoid infinite loop in BiomeCacheBlock)
     */
    public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int z, int width, int length, bool cacheFlag)
    {
//		IntCache.resetIntCache();

        if (listToReuse == null || listToReuse.Length < width * length)
        {
            listToReuse = new BiomeGenBase[width * length];
        }

        if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (z & 15) == 0)
        {
            BiomeGenBase[] abiomegenbase = biomeCache.getCachedBiomes(x, z);
            System.Array.Copy(abiomegenbase, 0, listToReuse, 0, width * length);
            return(listToReuse);
        }
        else
        {
            int[] aint = biomeIndexLayer.getInts(x, z, width, length);

            for (int i = 0; i < width * length; ++i)
            {
                listToReuse[i] = BiomeGenBase.getBiomeFromBiomeList(aint[i], BiomeGenBase.field_180279_ad);
            }

            return(listToReuse);
        }
    }
Esempio n. 4
0
 public static BiomeGenBase getBiomeFromBiomeList(int biomeId, BiomeGenBase biome)
 {
     if (biomeId >= 0 && biomeId <= biomeList.Length)
     {
         BiomeGenBase biomegenbase = biomeList [biomeId];
         return(biomegenbase == null ? biome : biomegenbase);
     }
     else
     {
         Debug.LogFormat("Biome ID is out of bounds: " + biomeId + ", defaulting to 0 (Ocean)");
         return(ocean);
     }
 }
Esempio n. 5
0
        public BiomeGenBase[] func_35142_b(BiomeGenBase[] abiomegenbase, int i, int j, int k, int l)
        {
            IntCache.func_35550_a();
            if (abiomegenbase == null || abiomegenbase.Length < k * l)
            {
                abiomegenbase = new BiomeGenBase[k * l];
            }
            int[] ai = field_34907_a.func_35018_a(i, j, k, l);
            for (int i1 = 0; i1 < k * l; i1++)
            {
                abiomegenbase[i1] = BiomeGenBase.biomeList[ai[i1]];
            }

            return(abiomegenbase);
        }
Esempio n. 6
0
    protected static bool biomesEqualOrMesaPlateau(int biomeIDA, int biomeIDB)
    {
        if (biomeIDA == biomeIDB)
        {
            return(true);
        }
        else if (biomeIDA != BiomeGenBase.mesaPlateau_F.biomeID && biomeIDA != BiomeGenBase.mesaPlateau.biomeID)
        {
            BiomeGenBase biomegenbase  = BiomeGenBase.getBiome(biomeIDA);
            BiomeGenBase biomegenbase1 = BiomeGenBase.getBiome(biomeIDB);

            return((biomegenbase != null && biomegenbase1 != null) ? biomegenbase.isEqualTo(biomegenbase1) : false);
        }
        else
        {
            return(biomeIDB == BiomeGenBase.mesaPlateau_F.biomeID || biomeIDB == BiomeGenBase.mesaPlateau.biomeID);
        }
    }
Esempio n. 7
0
        public bool func_35141_a(int i, int j, int k, List <BiomeGenBase> list)
        {
            int l  = i - k >> 2;
            int i1 = j - k >> 2;
            int j1 = i + k >> 2;
            int k1 = j + k >> 2;
            int l1 = (j1 - l) + 1;
            int i2 = (k1 - i1) + 1;

            int[] ai = field_34907_a.func_35018_a(l, i1, l1, i2);
            for (int j2 = 0; j2 < l1 * i2; j2++)
            {
                BiomeGenBase biomegenbase = BiomeGenBase.biomeList[ai[j2]];
                if (!list.Contains(biomegenbase))
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 8
0
        public BiomeGenBase[] func_35140_a(BiomeGenBase[] abiomegenbase, int i, int j, int k, int l, bool flag)
        {
            IntCache.func_35550_a();
            if (abiomegenbase == null || abiomegenbase.Length < k * l)
            {
                abiomegenbase = new BiomeGenBase[k * l];
            }
            if (flag && k == 16 && l == 16 && (i & 0xf) == 0 && (j & 0xf) == 0)
            {
                BiomeGenBase[] abiomegenbase1 = biomeCache.func_35682_b(i, j);
                Array.Copy(abiomegenbase1, 0, abiomegenbase, 0, k * l);
                return(abiomegenbase);
            }
            int[] ai = field_34906_b.func_35018_a(i, j, k, l);
            for (int i1 = 0; i1 < k * l; i1++)
            {
                abiomegenbase[i1] = BiomeGenBase.biomeList[ai[i1]];
            }

            return(abiomegenbase);
        }
Esempio n. 9
0
    /**
     * Returns if two biomes can logically be neighbors. If one is hot and the other cold, for example, it returns
     * false.
     */
    private bool canBiomesBeNeighbors(int p_151634_1_, int p_151634_2_)
    {
        if (biomesEqualOrMesaPlateau(p_151634_1_, p_151634_2_))
        {
            return(true);
        }
        else
        {
            BiomeGenBase biomegenbase  = BiomeGenBase.getBiome(p_151634_1_);
            BiomeGenBase biomegenbase1 = BiomeGenBase.getBiome(p_151634_2_);

            if (biomegenbase != null && biomegenbase1 != null)
            {
                BiomeGenBase.TempCategory biomegenbase_tempcategory  = biomegenbase.getTempCategory();
                BiomeGenBase.TempCategory biomegenbase_tempcategory1 = biomegenbase1.getTempCategory();
                return(biomegenbase_tempcategory == biomegenbase_tempcategory1 || biomegenbase_tempcategory == BiomeGenBase.TempCategory.MEDIUM || biomegenbase_tempcategory1 == BiomeGenBase.TempCategory.MEDIUM);
            }
            else
            {
                return(false);
            }
        }
    }
Esempio n. 10
0
    /**
     * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
     * amounts, or biomeList[] indices based on the particular GenLayer subclass.
     */
    public override int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight)
    {
        int[] aint  = parent.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2);
        int[] aint1 = field_151628_d.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2);
        int[] aint2 = IntCache.getIntCache(areaWidth * areaHeight);

        for (int i = 0; i < areaHeight; ++i)
        {
            for (int j = 0; j < areaWidth; ++j)
            {
                initChunkSeed((long)(j + areaX), (long)(i + areaY));
                int  k    = aint[j + 1 + (i + 1) * (areaWidth + 2)];
                int  l    = aint1[j + 1 + (i + 1) * (areaWidth + 2)];
                bool flag = (l - 2) % 29 == 0;

                if (k > 255)
                {
                    Debug.LogFormat("old! " + k);
                }

                if (k != 0 && l >= 2 && (l - 2) % 29 == 1 && k < 128)
                {
                    if (BiomeGenBase.getBiome(k + 128) != null)
                    {
                        aint2[j + i * areaWidth] = k + 128;
                    }
                    else
                    {
                        aint2[j + i * areaWidth] = k;
                    }
                }
                else if (this.nextInt(3) != 0 && !flag)
                {
                    aint2[j + i * areaWidth] = k;
                }
                else
                {
                    int i1 = k;

                    if (k == BiomeGenBase.desert.biomeID)
                    {
                        i1 = BiomeGenBase.desertHills.biomeID;
                    }
                    else if (k == BiomeGenBase.forest.biomeID)
                    {
                        i1 = BiomeGenBase.forestHills.biomeID;
                    }
                    else if (k == BiomeGenBase.birchForest.biomeID)
                    {
                        i1 = BiomeGenBase.birchForestHills.biomeID;
                    }
                    else if (k == BiomeGenBase.roofedForest.biomeID)
                    {
                        i1 = BiomeGenBase.plains.biomeID;
                    }
                    else if (k == BiomeGenBase.taiga.biomeID)
                    {
                        i1 = BiomeGenBase.taigaHills.biomeID;
                    }
                    else if (k == BiomeGenBase.megaTaiga.biomeID)
                    {
                        i1 = BiomeGenBase.megaTaigaHills.biomeID;
                    }
                    else if (k == BiomeGenBase.coldTaiga.biomeID)
                    {
                        i1 = BiomeGenBase.coldTaigaHills.biomeID;
                    }
                    else if (k == BiomeGenBase.plains.biomeID)
                    {
                        if (this.nextInt(3) == 0)
                        {
                            i1 = BiomeGenBase.forestHills.biomeID;
                        }
                        else
                        {
                            i1 = BiomeGenBase.forest.biomeID;
                        }
                    }
                    else if (k == BiomeGenBase.icePlains.biomeID)
                    {
                        i1 = BiomeGenBase.iceMountains.biomeID;
                    }
                    else if (k == BiomeGenBase.jungle.biomeID)
                    {
                        i1 = BiomeGenBase.jungleHills.biomeID;
                    }
                    else if (k == BiomeGenBase.ocean.biomeID)
                    {
                        i1 = BiomeGenBase.deepOcean.biomeID;
                    }
                    else if (k == BiomeGenBase.extremeHills.biomeID)
                    {
                        i1 = BiomeGenBase.extremeHillsPlus.biomeID;
                    }
                    else if (k == BiomeGenBase.savanna.biomeID)
                    {
                        i1 = BiomeGenBase.savannaPlateau.biomeID;
                    }
                    else if (biomesEqualOrMesaPlateau(k, BiomeGenBase.mesaPlateau_F.biomeID))
                    {
                        i1 = BiomeGenBase.mesa.biomeID;
                    }
                    else if (k == BiomeGenBase.deepOcean.biomeID && nextInt(3) == 0)
                    {
                        int j1 = this.nextInt(2);

                        if (j1 == 0)
                        {
                            i1 = BiomeGenBase.plains.biomeID;
                        }
                        else
                        {
                            i1 = BiomeGenBase.forest.biomeID;
                        }
                    }

                    if (flag && i1 != k)
                    {
                        if (BiomeGenBase.getBiome(i1 + 128) != null)
                        {
                            i1 += 128;
                        }
                        else
                        {
                            i1 = k;
                        }
                    }

                    if (i1 == k)
                    {
                        aint2[j + i * areaWidth] = k;
                    }
                    else
                    {
                        int k2 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)];
                        int k1 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)];
                        int l1 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)];
                        int i2 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)];
                        int j2 = 0;

                        if (biomesEqualOrMesaPlateau(k2, k))
                        {
                            ++j2;
                        }

                        if (biomesEqualOrMesaPlateau(k1, k))
                        {
                            ++j2;
                        }

                        if (biomesEqualOrMesaPlateau(l1, k))
                        {
                            ++j2;
                        }

                        if (biomesEqualOrMesaPlateau(i2, k))
                        {
                            ++j2;
                        }

                        if (j2 >= 3)
                        {
                            aint2[j + i * areaWidth] = i1;
                        }
                        else
                        {
                            aint2[j + i * areaWidth] = k;
                        }
                    }
                }
            }
        }

        return(aint2);
    }
 public BiomeEndDecorator(BiomeGenBase par1BiomeGenBase) : base(par1BiomeGenBase)
 {
     SpikeGen = new WorldGenSpikes(Block.WhiteStone.BlockID);
 }
Esempio n. 12
0
 private bool func_151633_d(int p_151633_1_)
 {
     return(BiomeGenBase.getBiome(p_151633_1_).GetType().ToString() == "BiomeGenMesa");
 }
Esempio n. 13
0
 private bool func_151631_c(int p_151631_1_)
 {
     return(BiomeGenBase.getBiome(p_151631_1_) != null && BiomeGenBase.getBiome(p_151631_1_).GetType().ToString() == "BiomeGenJungle" ? true : p_151631_1_ == BiomeGenBase.jungleEdge.biomeID || p_151631_1_ == BiomeGenBase.jungle.biomeID || p_151631_1_ == BiomeGenBase.jungleHills.biomeID || p_151631_1_ == BiomeGenBase.forest.biomeID || p_151631_1_ == BiomeGenBase.taiga.biomeID || isBiomeOceanic(p_151631_1_));
 }
Esempio n. 14
0
    /**
     * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
     * amounts, or biomeList[] indices based on the particular GenLayer subclass.
     */
    public override int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight)
    {
        int[] aint  = parent.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2);
        int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight);

        for (int i = 0; i < areaHeight; ++i)
        {
            for (int j = 0; j < areaWidth; ++j)
            {
                initChunkSeed((long)(j + areaX), (long)(i + areaY));
                int          k            = aint[j + 1 + (i + 1) * (areaWidth + 2)];
                BiomeGenBase biomegenbase = BiomeGenBase.getBiome(k);

                if (k == BiomeGenBase.mushroomIsland.biomeID)
                {
                    int j2 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)];
                    int i3 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)];
                    int l3 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)];
                    int k4 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)];

                    if (j2 != BiomeGenBase.ocean.biomeID && i3 != BiomeGenBase.ocean.biomeID && l3 != BiomeGenBase.ocean.biomeID && k4 != BiomeGenBase.ocean.biomeID)
                    {
                        aint1[j + i * areaWidth] = k;
                    }
                    else
                    {
                        aint1[j + i * areaWidth] = BiomeGenBase.mushroomIslandShore.biomeID;
                    }
                }
                else if (biomegenbase != null && biomegenbase.GetType().ToString() == "BiomeGenJungle")
                {
                    int i2 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)];
                    int l2 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)];
                    int k3 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)];
                    int j4 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)];

                    if (this.func_151631_c(i2) && this.func_151631_c(l2) && this.func_151631_c(k3) && this.func_151631_c(j4))
                    {
                        if (!isBiomeOceanic(i2) && !isBiomeOceanic(l2) && !isBiomeOceanic(k3) && !isBiomeOceanic(j4))
                        {
                            aint1[j + i * areaWidth] = k;
                        }
                        else
                        {
                            aint1[j + i * areaWidth] = BiomeGenBase.beach.biomeID;
                        }
                    }
                    else
                    {
                        aint1[j + i * areaWidth] = BiomeGenBase.jungleEdge.biomeID;
                    }
                }
                else if (k != BiomeGenBase.extremeHills.biomeID && k != BiomeGenBase.extremeHillsPlus.biomeID && k != BiomeGenBase.extremeHillsEdge.biomeID)
                {
                    if (biomegenbase != null && biomegenbase.isSnowyBiome())
                    {
                        this.func_151632_a(aint, aint1, j, i, areaWidth, k, BiomeGenBase.coldBeach.biomeID);
                    }
                    else if (k != BiomeGenBase.mesa.biomeID && k != BiomeGenBase.mesaPlateau_F.biomeID)
                    {
                        if (k != BiomeGenBase.ocean.biomeID && k != BiomeGenBase.deepOcean.biomeID && k != BiomeGenBase.river.biomeID && k != BiomeGenBase.swampland.biomeID)
                        {
                            int l1 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)];
                            int k2 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)];
                            int j3 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)];
                            int i4 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)];

                            if (!isBiomeOceanic(l1) && !isBiomeOceanic(k2) && !isBiomeOceanic(j3) && !isBiomeOceanic(i4))
                            {
                                aint1[j + i * areaWidth] = k;
                            }
                            else
                            {
                                aint1[j + i * areaWidth] = BiomeGenBase.beach.biomeID;
                            }
                        }
                        else
                        {
                            aint1[j + i * areaWidth] = k;
                        }
                    }
                    else
                    {
                        int l  = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)];
                        int i1 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)];
                        int j1 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)];
                        int k1 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)];

                        if (!isBiomeOceanic(l) && !isBiomeOceanic(i1) && !isBiomeOceanic(j1) && !isBiomeOceanic(k1))
                        {
                            if (this.func_151633_d(l) && this.func_151633_d(i1) && this.func_151633_d(j1) && this.func_151633_d(k1))
                            {
                                aint1[j + i * areaWidth] = k;
                            }
                            else
                            {
                                aint1[j + i * areaWidth] = BiomeGenBase.desert.biomeID;
                            }
                        }
                        else
                        {
                            aint1[j + i * areaWidth] = k;
                        }
                    }
                }
                else
                {
                    this.func_151632_a(aint, aint1, j, i, areaWidth, k, BiomeGenBase.stoneBeach.biomeID);
                }
            }
        }

        return(aint1);
    }
Esempio n. 15
0
 /**
  * returns true if the biome specified is equal to this biome
  */
 public bool isEqualTo(BiomeGenBase biome)
 {
     return(biome == this ? true : (biome == null ? false : GetType() == biome.GetType()));
 }