Пример #1
0
 public override int[] getInts(int i, int j, int k, int l)
 {
     int[] ai  = field_35512_b.getInts(i, j, k, l);
     int[] ai1 = field_35513_c.getInts(i, j, k, l);
     int[] ai2 = IntCache.getIntCache(k * l);
     for (int i1 = 0; i1 < k * l; i1++)
     {
         if (ai[i1] == BiomeGenBase.ocean.biomeID)
         {
             ai2[i1] = ai[i1];
             continue;
         }
         if (ai1[i1] >= 0)
         {
             if (ai[i1] == BiomeGenBase.icePlains.biomeID)
             {
                 ai2[i1] = BiomeGenBase.frozenRiver.biomeID;
                 continue;
             }
             if (ai[i1] == BiomeGenBase.mushroomIsland.biomeID || ai[i1] == BiomeGenBase.mushroomIslandShore.biomeID)
             {
                 ai2[i1] = BiomeGenBase.mushroomIslandShore.biomeID;
             }
             else
             {
                 ai2[i1] = ai1[i1];
             }
         }
         else
         {
             ai2[i1] = ai[i1];
         }
     }
     return(ai2);
 }
Пример #2
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);
        }
    }
Пример #3
0
        public override int[] getInts(int i, int j, int k, int l)
        {
            int[] ai  = parent.getInts(i, j, k, l);
            int[] ai1 = field_35505_b.getInts(i, j, k, l);
            int[] ai2 = IntCache.getIntCache(k * l);
            for (int i1 = 0; i1 < k * l; i1++)
            {
                ai2[i1] = ai1[i1] + (BiomeGenBase.biomeList[ai[i1]].getIntTemperature() - ai1[i1]) / (field_35506_c * 2 + 1);
            }

            return(ai2);
        }
Пример #4
0
        public override int[] getInts(int par1, int par2, int par3, int par4)
        {
            int[] ai  = field_35512_b.getInts(par1, par2, par3, par4);
            int[] ai1 = field_35513_c.getInts(par1, par2, par3, par4);
            int[] ai2 = IntCache.getIntCache(par3 * par4);

            for (int i = 0; i < par3 * par4; i++)
            {
                if (ai[i] == BiomeGenBase.ocean.biomeID)
                {
                    ai2[i] = ai[i];
                    continue;
                }

                if (ai1[i] >= 0)
                {
                    if (ai[i] == BiomeGenBase.icePlains.biomeID)
                    {
                        ai2[i] = BiomeGenBase.frozenRiver.biomeID;
                        continue;
                    }

                    if (ai[i] == BiomeGenBase.mushroomIsland.biomeID || ai[i] == BiomeGenBase.mushroomIslandShore.biomeID)
                    {
                        ai2[i] = BiomeGenBase.mushroomIslandShore.biomeID;
                    }
                    else
                    {
                        ai2[i] = ai1[i];
                    }
                }
                else
                {
                    ai2[i] = ai[i];
                }
            }

            return(ai2);
        }
Пример #5
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);
    }