コード例 #1
0
  /** Returns true if at least one block has changed. */
  public static final boolean genBlob(
      DecoratorFeatureGenerator gen, double x, double y, double z, double rad, Block block) {
    boolean generatedSomething = false;
    double radSq = MathUtil.square(rad + 0.5D);
    int size = MathUtil.ceil(rad),
        ix = MathUtil.floor(x),
        iy = MathUtil.floor(y),
        iz = MathUtil.floor(z);
    List<BlockPosM> locs = new ArrayList<BlockPosM>();

    for (int xx = ix - size; xx <= ix + size; xx++) {
      for (int yy = iy - size; yy <= iy + size; yy++) {
        for (int zz = iz - size; zz <= iz + size; zz++) {
          if (MathUtil.distanceSquared(xx - x, yy - y, zz - z) <= radSq) {
            if (gen.getBlock(xx, yy, zz) != block && gen.setBlock(xx, yy, zz, block)) {
              generatedSomething = true;
              locs.add(new BlockPosM(xx, yy, zz));
            }
          }
        }
      }
    }

    return generatedSomething;
  }
コード例 #2
0
 @SideOnly(Side.CLIENT)
 protected static final float getRenderDistanceMp() {
   return MathUtil.clamp(
       1F - MathUtil.square(Minecraft.getMinecraft().gameSettings.renderDistanceChunks) / 300F,
       0F,
       1F); // 16 chunks -> max 256
 }
コード例 #3
0
  /**
   * Returns true to apply default vanilla values to fog position. Can be overridden to configure
   * fog GL settings.
   */
  @SideOnly(Side.CLIENT)
  public boolean setupFog() {
    float voidFactor = (float) EndTerritory.getVoidFactor(Minecraft.getMinecraft().thePlayer);
    float fogMultiplier = Math.max(1F, MathUtil.square(voidFactor * 0.8F + 0.8F));

    GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP2);
    GL11.glFogf(GL11.GL_FOG_DENSITY, getFogDensity() * fogMultiplier);
    GL11.glHint(GL11.GL_FOG_HINT, GL11.GL_DONT_CARE);
    return true;
  }