Ejemplo n.º 1
0
 private void logDebug(EntityPlayer player, String message) {
   if (player == null) {
     Logging.log(message);
   } else {
     Logging.message(player, EnumChatFormatting.YELLOW + message);
   }
 }
Ejemplo n.º 2
0
  private void func_147423_a(int chunkX4, int chunkY4, int chunkZ4) {
    this.noiseData4 =
        this.noiseGen6.generateNoiseOctaves(
            this.noiseData4, chunkX4, chunkZ4, 5, 5, 200.0D, 200.0D, 0.5D);
    this.noiseData1 =
        this.noiseGen3.generateNoiseOctaves(
            this.noiseData1,
            chunkX4,
            chunkY4,
            chunkZ4,
            5,
            33,
            5,
            8.555150000000001D,
            4.277575000000001D,
            8.555150000000001D);
    this.noiseData2 =
        this.noiseGen1.generateNoiseOctaves(
            this.noiseData2, chunkX4, chunkY4, chunkZ4, 5, 33, 5, 684.412D, 684.412D, 684.412D);
    this.noiseData3 =
        this.noiseGen2.generateNoiseOctaves(
            this.noiseData3, chunkX4, chunkY4, chunkZ4, 5, 33, 5, 684.412D, 684.412D, 684.412D);
    int l = 0;
    int i1 = 0;

    boolean domaze = false;
    boolean elevated = false;
    boolean donearlands =
        provider.dimensionInformation.getTerrainType() == TerrainType.TERRAIN_NEARLANDS;

    if (donearlands) {
      elevated = true;
    }

    if (provider.dimensionInformation.hasFeatureType(FeatureType.FEATURE_MAZE)) {
      domaze = true;
      long s2 = (((chunkX4 >> 2) + provider.seed + 13) * 314) + (chunkZ4 >> 2) * 17L;
      Random rand = new Random(s2);
      rand.nextFloat(); // Skip one.
      elevated = ((chunkX4 >> 2) & 1) == 0;
      if (rand.nextFloat() < .2f) {
        elevated = !elevated;
      }
    }

    if (donearlands) {
      int cx = chunkX4 >> 2;
      int cz = chunkZ4 >> 2;
      if (Math.abs(cx) < 5 && Math.abs(cz) < 5) {
        elevated = false;
      }
    }

    if (provider.biomesForGeneration == null) {
      Logging.log("Dimension " + world.provider.dimensionId + " has a problem! Ignoring for now.");
      return;
    }

    for (int j1 = 0; j1 < 5; ++j1) {
      for (int k1 = 0; k1 < 5; ++k1) {
        float f = 0.0F;
        float f1 = 0.0F;
        float f2 = 0.0F;
        byte b0 = 2;
        BiomeGenBase biomegenbase = provider.biomesForGeneration[j1 + 2 + (k1 + 2) * 10];

        for (int l1 = -b0; l1 <= b0; ++l1) {
          for (int i2 = -b0; i2 <= b0; ++i2) {
            BiomeGenBase biomegenbase1 =
                provider.biomesForGeneration[j1 + l1 + 2 + (k1 + i2 + 2) * 10];
            float f3 = biomegenbase1.rootHeight;
            float f4 = biomegenbase1.heightVariation;

            if (domaze || donearlands) {
              if (f3 > 0.0F && elevated) {
                if (provider.worldType == WorldType.AMPLIFIED) {
                  f3 = 2.0F + f3 * 1.5f;
                  f4 = 1.0F + f4 * 3.0f;
                } else {
                  f3 = 2.0F + f3;
                  f4 = 0.5F + f4 * 1.5f;
                }
              } else {
                if (provider.worldType == WorldType.AMPLIFIED && f3 > 0.0f) {
                  f3 = 0.5F + f3 * 1.5F;
                  f4 = 0.5F + f4 * 2.0F;
                } else {
                  f4 = f4 * 0.5F;
                }
              }
            } else {
              if (provider.worldType == WorldType.AMPLIFIED && f3 > 0.0F) {
                f3 = 1.0F + f3 * 2.0F;
                f4 = 1.0F + f4 * 4.0F;
              }
            }

            float f5 = parabolicField[l1 + 2 + (i2 + 2) * 5] / (f3 + 2.0F);

            if (biomegenbase1.rootHeight > biomegenbase.rootHeight) {
              f5 /= 2.0F;
            }

            f += f4 * f5;
            f1 += f3 * f5;
            f2 += f5;
          }
        }

        f /= f2;
        f1 /= f2;
        f = f * 0.9F + 0.1F;
        f1 = (f1 * 4.0F - 1.0F) / 8.0F;
        double d12 = this.noiseData4[i1] / 8000.0D;

        if (d12 < 0.0D) {
          d12 = -d12 * 0.3D;
        }

        d12 = d12 * 3.0D - 2.0D;

        if (d12 < 0.0D) {
          d12 /= 2.0D;

          if (d12 < -1.0D) {
            d12 = -1.0D;
          }

          d12 /= 1.4D;
          d12 /= 2.0D;
        } else {
          if (d12 > 1.0D) {
            d12 = 1.0D;
          }

          d12 /= 8.0D;
        }

        ++i1;
        double d13 = f1;
        double d14 = f;
        d13 += d12 * 0.2D;
        d13 = d13 * 8.5D / 8.0D;
        double d5 = 8.5D + d13 * 4.0D;

        for (int j2 = 0; j2 < 33; ++j2) {
          double d6 = (j2 - d5) * 12.0D * 128.0D / 256.0D / d14;

          if (d6 < 0.0D) {
            d6 *= 4.0D;
          }

          double d7 = this.noiseData2[l] / 512.0D;
          double d8 = this.noiseData3[l] / 512.0D;
          double d9 = (this.noiseData1[l] / 10.0D + 1.0D) / 2.0D;
          double d10 = MathHelper.denormalizeClamp(d7, d8, d9) - d6;

          if (j2 > 29) {
            double d11 = ((j2 - 29) / 3.0F);
            d10 = d10 * (1.0D - d11) + -10.0D * d11;
          }

          this.noiseField[l] = d10;
          ++l;
        }
      }
    }
  }