public ChunkPosition a(int i0, int i1, int i2, List list, Random random) {
    IntCache.a();
    int i3 = i0 - i2 >> 2;
    int i4 = i1 - i2 >> 2;
    int i5 = i0 + i2 >> 2;
    int i6 = i1 + i2 >> 2;
    int i7 = i5 - i3 + 1;
    int i8 = i6 - i4 + 1;
    int[] aint = this.d.a(i3, i4, i7, i8);
    ChunkPosition chunkposition = null;
    int i9 = 0;

    for (int i10 = 0; i10 < i7 * i8; ++i10) {
      int i11 = i3 + i10 % i7 << 2;
      int i12 = i4 + i10 / i7 << 2;
      BiomeGenBase biomegenbase = BiomeGenBase.a[aint[i10]];

      if (list.contains(biomegenbase) && (chunkposition == null || random.nextInt(i9 + 1) == 0)) {
        chunkposition = new ChunkPosition(i11, 0, i12);
        ++i9;
      }
    }

    return chunkposition;
  }
  /**
   * 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 int[] getInts(int par1, int par2, int par3, int par4) {
    int ai[] = biomePatternGeneratorChain.getInts(par1, par2, par3, par4);
    int ai1[] = riverPatternGeneratorChain.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;
  }
Beispiel #3
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 int[] getInts(int par1, int par2, int par3, int par4) {
    int var5 = par1 - 1;
    int var6 = par2 - 1;
    int var7 = par3 + 2;
    int var8 = par4 + 2;
    int[] var9 = this.parent.getInts(var5, var6, var7, var8);
    int[] var10 = IntCache.getIntCache(par3 * par4);

    for (int var11 = 0; var11 < par4; ++var11) {
      for (int var12 = 0; var12 < par3; ++var12) {
        int var13 = var9[var12 + 0 + (var11 + 1) * var7];
        int var14 = var9[var12 + 2 + (var11 + 1) * var7];
        int var15 = var9[var12 + 1 + (var11 + 0) * var7];
        int var16 = var9[var12 + 1 + (var11 + 2) * var7];
        int var17 = var9[var12 + 1 + (var11 + 1) * var7];

        if (var17 != 0
            && var13 != 0
            && var14 != 0
            && var15 != 0
            && var16 != 0
            && var17 == var13
            && var17 == var15
            && var17 == var14
            && var17 == var16) {
          var10[var12 + var11 * par3] = -1;
        } else {
          var10[var12 + var11 * par3] = BiomeGenBase.river.biomeID;
        }
      }
    }

    return var10;
  }
Beispiel #4
0
  /** Finds a valid position within a range, that is once of the listed biomes. */
  public ChunkPosition a(int var1, int var2, int var3, List var4, Random var5) {
    IntCache.a();
    int var6 = var1 - var3 >> 2;
    int var7 = var2 - var3 >> 2;
    int var8 = var1 + var3 >> 2;
    int var9 = var2 + var3 >> 2;
    int var10 = var8 - var6 + 1;
    int var11 = var9 - var7 + 1;
    int[] var12 = this.d.a(var6, var7, var10, var11);
    ChunkPosition var13 = null;
    int var14 = 0;

    for (int var15 = 0; var15 < var10 * var11; ++var15) {
      int var16 = var6 + var15 % var10 << 2;
      int var17 = var7 + var15 / var10 << 2;
      BiomeBase var18 = BiomeBase.biomes[var12[var15]];

      if (var4.contains(var18) && (var13 == null || var5.nextInt(var14 + 1) == 0)) {
        var13 = new ChunkPosition(var16, 0, var17);
        ++var14;
      }
    }

    return var13;
  }
  /**
   * 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 int[] getInts(int par1, int par2, int par3, int par4) {
    int[] var5 = this.parent.getInts(par1, par2, par3, par4);
    int[] var6 = IntCache.getIntCache(par3 * par4);

    for (int var7 = 0; var7 < par4; ++var7) {
      for (int var8 = 0; var8 < par3; ++var8) {
        this.initChunkSeed((long) (var8 + par1), (long) (var7 + par2));
        int var9 = var5[var8 + var7 * par3];

        if (var9 == 0) {
          var6[var8 + var7 * par3] = 0;
        } else if (var9 == BiomeGenBase.mushroomIsland.biomeID) {
          var6[var8 + var7 * par3] = var9;
        } else if (var9 == 1) {
          var6[var8 + var7 * par3] =
              this.allowedBiomes[this.nextInt(this.allowedBiomes.length)].biomeID;
        } else {
          int var10 = this.allowedBiomes[this.nextInt(this.allowedBiomes.length)].biomeID;

          if (var10 == BiomeGenBase.taiga.biomeID) {
            var6[var8 + var7 * par3] = var10;
          } else {
            var6[var8 + var7 * par3] = BiomeGenBase.icePlains.biomeID;
          }
        }
      }
    }

    return var6;
  }
  public int[] getInts(int i, int j, int k, int l) {
    int ai[] = parent.getInts(i, j, k, l);
    int ai1[] = IntCache.getIntCache(k * l);
    for (int i1 = 0; i1 < l; i1++) {
      for (int j1 = 0; j1 < k; j1++) {
        initChunkSeed(j1 + i, i1 + j);
        ai1[j1 + i1 * k] = ai[j1 + i1 * k] <= 0 ? 0 : nextInt(2) + 2;
      }
    }

    return ai1;
  }
  public int[] func_75904_a(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_) {
    int i = p_75904_1_ >> 1;
    int j = p_75904_2_ >> 1;
    int k = (p_75904_3_ >> 1) + 3;
    int l = (p_75904_4_ >> 1) + 3;
    int ai[] = field_75909_a.func_75904_a(i, j, k, l);
    int ai1[] = IntCache.func_76445_a(k * 2 * (l * 2));
    int i1 = k << 1;
    for (int j1 = 0; j1 < l - 1; j1++) {
      int k1 = j1 << 1;
      int i2 = k1 * i1;
      int j2 = ai[0 + (j1 + 0) * k];
      int k2 = ai[0 + (j1 + 1) * k];
      for (int l2 = 0; l2 < k - 1; l2++) {
        func_75903_a(l2 + i << 1, j1 + j << 1);
        int i3 = ai[l2 + 1 + (j1 + 0) * k];
        int j3 = ai[l2 + 1 + (j1 + 1) * k];
        ai1[i2] = j2;
        ai1[i2++ + i1] = func_75917_a(j2, k2);
        ai1[i2] = func_75917_a(j2, i3);
        ai1[i2++ + i1] = func_75916_b(j2, i3, k2, j3);
        j2 = i3;
        k2 = j3;
      }
    }

    int ai2[] = IntCache.func_76445_a(p_75904_3_ * p_75904_4_);
    for (int l1 = 0; l1 < p_75904_4_; l1++) {
      System.arraycopy(
          ai1,
          (l1 + (p_75904_2_ & 1)) * (k << 1) + (p_75904_1_ & 1),
          ai2,
          l1 * p_75904_3_,
          p_75904_3_);
    }

    return ai2;
  }
  public int[] func_35500_a(int i, int j, int k, int l) {
    int ai[] = field_35512_b.func_35500_a(i, j, k, l);
    int ai1[] = field_35513_c.func_35500_a(i, j, k, l);
    int ai2[] = IntCache.func_35267_a(k * l);
    for (int i1 = 0; i1 < k * l; i1++) {
      if (ai[i1] == BiomeGenBase.field_35484_b.field_35494_y) {
        ai2[i1] = ai[i1];
      } else {
        ai2[i1] = ai1[i1] < 0 ? ai[i1] : ai1[i1];
      }
    }

    return ai2;
  }
Beispiel #9
0
  /** Returns an array of biomes for the location input. */
  public BiomeBase[] getBiomes(BiomeBase[] var1, int var2, int var3, int var4, int var5) {
    IntCache.a();

    if (var1 == null || var1.length < var4 * var5) {
      var1 = new BiomeBase[var4 * var5];
    }

    int[] var6 = this.d.a(var2, var3, var4, var5);

    for (int var7 = 0; var7 < var4 * var5; ++var7) {
      var1[var7] = BiomeBase.biomes[var6[var7]];
    }

    return var1;
  }
  /** Returns an array of biomes for the location input. */
  public BiomeGenBase[] getBiomesForGeneration(
      BiomeGenBase abiomegenbase[], int i, int j, int k, int l) {
    IntCache.resetIntCache();

    if (abiomegenbase == null || abiomegenbase.length < k * l) {
      abiomegenbase = new BiomeGenBase[k * l];
    }

    int ai[] = genBiomes.getInts(i, j, k, l);

    for (int i1 = 0; i1 < k * l; i1++) {
      abiomegenbase[i1] = BiomeGenBase.biomeList[ai[i1]];
    }

    return abiomegenbase;
  }
  public boolean a(int i0, int i1, int i2, List list) {
    IntCache.a();
    int i3 = i0 - i2 >> 2;
    int i4 = i1 - i2 >> 2;
    int i5 = i0 + i2 >> 2;
    int i6 = i1 + i2 >> 2;
    int i7 = i5 - i3 + 1;
    int i8 = i6 - i4 + 1;
    int[] aint = this.d.a(i3, i4, i7, i8);

    for (int i9 = 0; i9 < i7 * i8; ++i9) {
      BiomeGenBase biomegenbase = BiomeGenBase.a[aint[i9]];

      if (!list.contains(biomegenbase)) {
        return false;
      }
    }

    return true;
  }
  public float[] b(float[] afloat, int i0, int i1, int i2, int i3) {
    IntCache.a();
    if (afloat == null || afloat.length < i2 * i3) {
      afloat = new float[i2 * i3];
    }

    int[] aint = this.e.a(i0, i1, i2, i3);

    for (int i4 = 0; i4 < i2 * i3; ++i4) {
      float f0 = (float) BiomeGenBase.a[aint[i4]].h() / 65536.0F;

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

      afloat[i4] = f0;
    }

    return afloat;
  }
Beispiel #13
0
  /** checks given Chunk's Biomes against List of allowed ones */
  public boolean a(int var1, int var2, int var3, List var4) {
    IntCache.a();
    int var5 = var1 - var3 >> 2;
    int var6 = var2 - var3 >> 2;
    int var7 = var1 + var3 >> 2;
    int var8 = var2 + var3 >> 2;
    int var9 = var7 - var5 + 1;
    int var10 = var8 - var6 + 1;
    int[] var11 = this.d.a(var5, var6, var9, var10);

    for (int var12 = 0; var12 < var9 * var10; ++var12) {
      BiomeBase var13 = BiomeBase.biomes[var11[var12]];

      if (!var4.contains(var13)) {
        return false;
      }
    }

    return true;
  }
Beispiel #14
0
  /**
   * Returns a list of temperatures to use for the specified blocks. Args: listToReuse, x, y, width,
   * length
   */
  public float[] getTemperatures(float[] var1, int var2, int var3, int var4, int var5) {
    IntCache.a();

    if (var1 == null || var1.length < var4 * var5) {
      var1 = new float[var4 * var5];
    }

    int[] var6 = this.e.a(var2, var3, var4, var5);

    for (int var7 = 0; var7 < var4 * var5; ++var7) {
      float var8 = (float) BiomeBase.biomes[var6[var7]].h() / 65536.0F;

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

      var1[var7] = var8;
    }

    return var1;
  }
Beispiel #15
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 BiomeBase[] a(BiomeBase[] var1, int var2, int var3, int var4, int var5, boolean var6) {
    IntCache.a();

    if (var1 == null || var1.length < var4 * var5) {
      var1 = new BiomeBase[var4 * var5];
    }

    if (var6 && var4 == 16 && var5 == 16 && (var2 & 15) == 0 && (var3 & 15) == 0) {
      BiomeBase[] var9 = this.f.e(var2, var3);
      System.arraycopy(var9, 0, var1, 0, var4 * var5);
      return var1;
    } else {
      int[] var7 = this.e.a(var2, var3, var4, var5);

      for (int var8 = 0; var8 < var4 * var5; ++var8) {
        var1[var8] = BiomeBase.biomes[var7[var8]];
      }

      return var1;
    }
  }
  /**
   * Returns a list of temperatures to use for the specified blocks. Args: listToReuse, x, y, width,
   * length
   */
  public float[] getTemperatures(float af[], int i, int j, int k, int l) {
    IntCache.resetIntCache();

    if (af == null || af.length < k * l) {
      af = new float[k * l];
    }

    int ai[] = biomeIndexLayer.getInts(i, j, k, l);

    for (int i1 = 0; i1 < k * l; i1++) {
      float f = (float) BiomeGenBase.biomeList[ai[i1]].getIntTemperature() / 65536F;

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

      af[i1] = f;
    }

    return af;
  }
  public BiomeGenBase[] a(
      BiomeGenBase[] abiomegenbase, int i0, int i1, int i2, int i3, boolean flag0) {
    IntCache.a();
    if (abiomegenbase == null || abiomegenbase.length < i2 * i3) {
      abiomegenbase = new BiomeGenBase[i2 * i3];
    }

    if (flag0 && i2 == 16 && i3 == 16 && (i0 & 15) == 0 && (i1 & 15) == 0) {
      BiomeGenBase[] abiomegenbase1 = this.f.e(i0, i1);

      System.arraycopy(abiomegenbase1, 0, abiomegenbase, 0, i2 * i3);
      return abiomegenbase;
    } else {
      int[] aint = this.e.a(i0, i1, i2, i3);

      for (int i4 = 0; i4 < i2 * i3; ++i4) {
        abiomegenbase[i4] = BiomeGenBase.a[aint[i4]];
      }

      return abiomegenbase;
    }
  }
  /**
   * 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 abiomegenbase[], int i, int j, int k, int l, boolean flag) {
    IntCache.resetIntCache();

    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.getCachedBiomes(i, j);
      System.arraycopy(abiomegenbase1, 0, abiomegenbase, 0, k * l);
      return abiomegenbase;
    }

    int ai[] = biomeIndexLayer.getInts(i, j, k, l);

    for (int i1 = 0; i1 < k * l; i1++) {
      abiomegenbase[i1] = BiomeGenBase.biomeList[ai[i1]];
    }

    return abiomegenbase;
  }
  public BiomeGenBase[] a(BiomeGenBase[] abiomegenbase, int i0, int i1, int i2, int i3) {
    IntCache.a();
    if (abiomegenbase == null || abiomegenbase.length < i2 * i3) {
      abiomegenbase = new BiomeGenBase[i2 * i3];
    }

    int[] aint = this.d.a(i0, i1, i2, i3);

    for (int i4 = 0; i4 < i2 * i3; ++i4) {
      // CanaryMod: Biome disabling and replacements
      BiomeGenBase biomegenbase = BiomeGenBase.a[aint[i4]];
      if (Configuration.getWorldConfig(world_name).isBiomeDisabled(biomegenbase.N)) {
        String old = biomegenbase.y;
        biomegenbase =
            BiomeGenBase.a[
                Configuration.getWorldConfig(world_name).getReplacementBiomeId(biomegenbase.N)];
        Canary.logDebug("Biome: " + old + " is disabled and replaced with " + biomegenbase.y);
      }
      abiomegenbase[i4] = biomegenbase;
      //
    }

    return abiomegenbase;
  }
  public int[] a(int i, int j, int k, int l) {
    int[] aint = this.a.a(i - 1, j - 1, k + 2, l + 2);
    int[] aint1 = IntCache.a(k * l);

    for (int i1 = 0; i1 < l; ++i1) {
      for (int j1 = 0; j1 < k; ++j1) {
        this.a((long) (j1 + i), (long) (i1 + j));
        int k1 = aint[j1 + 1 + (i1 + 1) * (k + 2)];

        if (!this.a(
                aint,
                aint1,
                j1,
                i1,
                k,
                k1,
                BiomeBase.EXTREME_HILLS.id,
                BiomeBase.SMALL_MOUNTAINS.id)
            && !this.b(aint, aint1, j1, i1, k, k1, BiomeBase.MESA_PLATEAU_F.id, BiomeBase.MESA.id)
            && !this.b(aint, aint1, j1, i1, k, k1, BiomeBase.MESA_PLATEAU.id, BiomeBase.MESA.id)
            && !this.b(aint, aint1, j1, i1, k, k1, BiomeBase.MEGA_TAIGA.id, BiomeBase.TAIGA.id)) {
          int l1;
          int i2;
          int j2;
          int k2;

          if (k1 == BiomeBase.DESERT.id) {
            l1 = aint[j1 + 1 + (i1 + 1 - 1) * (k + 2)];
            i2 = aint[j1 + 1 + 1 + (i1 + 1) * (k + 2)];
            j2 = aint[j1 + 1 - 1 + (i1 + 1) * (k + 2)];
            k2 = aint[j1 + 1 + (i1 + 1 + 1) * (k + 2)];
            if (l1 != BiomeBase.ICE_PLAINS.id
                && i2 != BiomeBase.ICE_PLAINS.id
                && j2 != BiomeBase.ICE_PLAINS.id
                && k2 != BiomeBase.ICE_PLAINS.id) {
              aint1[j1 + i1 * k] = k1;
            } else {
              aint1[j1 + i1 * k] = BiomeBase.EXTREME_HILLS_PLUS.id;
            }
          } else if (k1 == BiomeBase.SWAMPLAND.id) {
            l1 = aint[j1 + 1 + (i1 + 1 - 1) * (k + 2)];
            i2 = aint[j1 + 1 + 1 + (i1 + 1) * (k + 2)];
            j2 = aint[j1 + 1 - 1 + (i1 + 1) * (k + 2)];
            k2 = aint[j1 + 1 + (i1 + 1 + 1) * (k + 2)];
            if (l1 != BiomeBase.DESERT.id
                && i2 != BiomeBase.DESERT.id
                && j2 != BiomeBase.DESERT.id
                && k2 != BiomeBase.DESERT.id
                && l1 != BiomeBase.COLD_TAIGA.id
                && i2 != BiomeBase.COLD_TAIGA.id
                && j2 != BiomeBase.COLD_TAIGA.id
                && k2 != BiomeBase.COLD_TAIGA.id
                && l1 != BiomeBase.ICE_PLAINS.id
                && i2 != BiomeBase.ICE_PLAINS.id
                && j2 != BiomeBase.ICE_PLAINS.id
                && k2 != BiomeBase.ICE_PLAINS.id) {
              if (l1 != BiomeBase.JUNGLE.id
                  && k2 != BiomeBase.JUNGLE.id
                  && i2 != BiomeBase.JUNGLE.id
                  && j2 != BiomeBase.JUNGLE.id) {
                aint1[j1 + i1 * k] = k1;
              } else {
                aint1[j1 + i1 * k] = BiomeBase.JUNGLE_EDGE.id;
              }
            } else {
              aint1[j1 + i1 * k] = BiomeBase.PLAINS.id;
            }
          } else {
            aint1[j1 + i1 * k] = k1;
          }
        }
      }
    }

    return aint1;
  }
  /**
   * 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 int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) {
    int var5 = areaX - 1;
    int var6 = areaY - 1;
    int var7 = areaWidth + 2;
    int var8 = areaHeight + 2;
    int[] var9 = this.parent.getInts(var5, var6, var7, var8);
    int[] var10 = IntCache.getIntCache(areaWidth * areaHeight);

    for (int var11 = 0; var11 < areaHeight; ++var11) {
      for (int var12 = 0; var12 < areaWidth; ++var12) {
        int var13 = var9[var12 + 0 + (var11 + 0) * var7];
        int var14 = var9[var12 + 2 + (var11 + 0) * var7];
        int var15 = var9[var12 + 0 + (var11 + 2) * var7];
        int var16 = var9[var12 + 2 + (var11 + 2) * var7];
        int var17 = var9[var12 + 1 + (var11 + 1) * var7];
        this.initChunkSeed((long) (var12 + areaX), (long) (var11 + areaY));

        if (var17 == 0 && (var13 != 0 || var14 != 0 || var15 != 0 || var16 != 0)) {
          int var18 = 1;
          int var19 = 1;

          if (var13 != 0 && this.nextInt(var18++) == 0) {
            var19 = var13;
          }

          if (var14 != 0 && this.nextInt(var18++) == 0) {
            var19 = var14;
          }

          if (var15 != 0 && this.nextInt(var18++) == 0) {
            var19 = var15;
          }

          if (var16 != 0 && this.nextInt(var18++) == 0) {
            var19 = var16;
          }

          if (this.nextInt(3) == 0) {
            var10[var12 + var11 * areaWidth] = var19;
          } else if (var19 == 4) {
            var10[var12 + var11 * areaWidth] = 4;
          } else {
            var10[var12 + var11 * areaWidth] = 0;
          }
        } else if (var17 > 0 && (var13 == 0 || var14 == 0 || var15 == 0 || var16 == 0)) {
          if (this.nextInt(5) == 0) {
            if (var17 == 4) {
              var10[var12 + var11 * areaWidth] = 4;
            } else {
              var10[var12 + var11 * areaWidth] = 0;
            }
          } else {
            var10[var12 + var11 * areaWidth] = var17;
          }
        } else {
          var10[var12 + var11 * areaWidth] = var17;
        }
      }
    }

    return var10;
  }