Ejemplo n.º 1
0
  public boolean renderCrossedSquares(Block block, int x, int y, int z, RenderBlocks renderer) {
    Tessellator var5 = Tessellator.instance;
    var5.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
    float var6 = 1.0F;
    int var7 = block.colorMultiplier(renderer.blockAccess, x, y, z);
    float var8 = (var7 >> 16 & 255) / 255.0F;
    float var9 = (var7 >> 8 & 255) / 255.0F;
    float var10 = (var7 & 255) / 255.0F;

    if (EntityRenderer.anaglyphEnable) {
      float var11 = (var8 * 30.0F + var9 * 59.0F + var10 * 11.0F) / 100.0F;
      float var12 = (var8 * 30.0F + var9 * 70.0F) / 100.0F;
      float var13 = (var8 * 30.0F + var10 * 70.0F) / 100.0F;
      var8 = var11;
      var9 = var12;
      var10 = var13;
    }

    var5.setColorOpaque_F(var6 * var8, var6 * var9, var6 * var10);
    double new_x = x;
    double new_y = y;
    double new_z = z;

    if (block == Block.tallGrass) {
      long var17 = (x * 3129871) ^ z * 116129781L ^ y;
      var17 = var17 * var17 * 42317861L + var17 * 11L;
      new_x += (((var17 >> 16 & 15L) / 15.0F) - 0.5D) * 0.5D;
      new_y += (((var17 >> 20 & 15L) / 15.0F) - 1.0D) * 0.2D;
      new_z += (((var17 >> 24 & 15L) / 15.0F) - 0.5D) * 0.5D;
    }

    drawThreeLeaves(
        block, renderer.blockAccess.getBlockMetadata(x, y, z), new_x, new_y, new_z, 1.0F, renderer);
    return true;
  }
 @Override
 public boolean renderWorldBlock(
     IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks rb) {
   Tessellator v5 = Tessellator.instance;
   int meta = world.getBlockMetadata(x, y, z);
   if (renderPass == 0) {
     int color = b.colorMultiplier(world, x, y, z);
     float red = ReikaColorAPI.getRed(color) / 255F;
     float grn = ReikaColorAPI.getGreen(color) / 255F;
     float blu = ReikaColorAPI.getBlue(color) / 255F;
     rb.renderStandardBlockWithAmbientOcclusion(b, x, y, z, red, grn, blu);
     return true;
   } else if (renderPass == 1) {
     LightedTreeBlock ltb = (LightedTreeBlock) b;
     IIcon ico = ltb.getOverlay(meta);
     v5.setBrightness(240);
     v5.setColorRGBA_I(0xffffff, b instanceof BlockLeavesBase ? 255 : 220);
     if (ltb.renderOverlayOnSide(0, meta)) rb.renderFaceYNeg(b, x, y, z, ico);
     if (ltb.renderOverlayOnSide(1, meta)) rb.renderFaceYPos(b, x, y, z, ico);
     if (ltb.renderOverlayOnSide(2, meta)) rb.renderFaceZNeg(b, x, y, z, ico);
     if (ltb.renderOverlayOnSide(3, meta)) rb.renderFaceZPos(b, x, y, z, ico);
     if (ltb.renderOverlayOnSide(4, meta)) rb.renderFaceXNeg(b, x, y, z, ico);
     if (ltb.renderOverlayOnSide(5, meta)) rb.renderFaceXPos(b, x, y, z, ico);
     return true;
   }
   return false;
 }
 private void renderLiquidPart(
     IBlockAccess world,
     int x,
     int y,
     int z,
     Block block,
     RenderBlocks renderer,
     CastingChannelLogic logic) {
   FluidStack liquid = logic.liquid;
   int color = block.colorMultiplier(world, x, y, z);
   float red = (color >> 16 & 0xFF) / 255.0F;
   float green = (color >> 8 & 0xFF) / 255.0F;
   float blue = (color & 0xFF) / 255.0F;
   Fluid fluid = liquid.getFluid();
   if (fluid.canBePlacedInWorld())
     BlockSkinRenderHelper.renderMetadataBlock(
         Block.blocksList[fluid.getBlockID()], 0, x, y, z, renderer, world);
   else
     BlockSkinRenderHelper.renderLiquidBlock(
         fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world);
 }
  private boolean renderBlockCrossedSquares(
      IBlockAccess blockAccess,
      int x,
      int y,
      int z,
      Block block,
      int modelID,
      RenderBlocks renderer) {
    Tessellator tessellator = Tessellator.instance;
    tessellator.setBrightness(block.getMixedBrightnessForBlock(blockAccess, x, y, z));
    float f = 1.0F;
    int l = block.colorMultiplier(blockAccess, x, y, z);
    float f1 = (float) (l >> 16 & 255) / 255.0F;
    float f2 = (float) (l >> 8 & 255) / 255.0F;
    float f3 = (float) (l & 255) / 255.0F;

    if (EntityRenderer.anaglyphEnable) {
      float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
      float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
      float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
      f1 = f4;
      f2 = f5;
      f3 = f6;
    }

    tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
    double xx = (double) x;
    double yy = (double) y;
    double zz = (double) z;
    if (block == Blocks.tallgrass) {
      long i1 = (long) (x * 3129871) ^ (long) z * 116129781L ^ (long) y;
      i1 = i1 * i1 * 42317861L + i1 * 11L;
      xx += ((double) ((float) (i1 >> 16 & 15L) / 15.0F) - 0.5D) * 0.5D;
      yy += ((double) ((float) (i1 >> 20 & 15L) / 15.0F) - 1.0D) * 0.2D;
      zz += ((double) ((float) (i1 >> 24 & 15L) / 15.0F) - 0.5D) * 0.5D;
    }
    drawCrossedSquares(
        blockAccess, xx, yy, zz, 1.0F, block, blockAccess.getBlockMetadata(x, y, z), renderer);
    return true;
  }
Ejemplo n.º 5
0
  public void vboRender(
      Block block,
      float var2,
      float height,
      float ampheight,
      float magnitude,
      float angle,
      float waveTime,
      int xx,
      int zz,
      float var3,
      float var4,
      float var5,
      float var6,
      float var7) {
    int dim = ModLoader.getMinecraftInstance().thePlayer.dimension;
    double playerY = ModLoader.getMinecraftInstance().thePlayer.posY;
    Tessellator var1 = Tessellator.instance;
    Icon icon = getParticleTextureIndex(dim, block);
    float var12 = 0.5F;
    float var13 = renderX - (float) EntityFX.interpPosX;
    float var14 = renderY - (float) EntityFX.interpPosY;
    float var15 = renderZ - (float) EntityFX.interpPosZ;

    // var14 = renderY - (renderYlast + ((float)playerY - renderYlast) * var2);

    // float var13 = renderX - (float)EntityFX.interpPosX;
    // var14 = (renderY - (float)playerY) - (renderYlast - renderY) * var2;
    // float var15 = renderZ - (float)EntityFX.interpPosZ;

    // System.out.println(var14);

    double distToCamera = Math.sqrt(var13 * var13 + var14 * var14 + var15 * var15);
    double distAlpha = 1D - ((distToCamera / ConfigWavesMisc.waveRenderRange) * 2D);
    float particleAlpha = 1F;

    if (dim == WeatherUtil.tropiDimID) {
      particleAlpha =
          0.9F
              * (float)
                  Math.min(
                      1D, 0.2 + ModLoader.getMinecraftInstance().theWorld.getSunBrightness(1F));
    }

    particleAlpha = (float) Math.max(0.10D, particleAlpha * distAlpha);
    if (particleAlpha == 0.1D) return;

    float br = entRef.getBrightness(var2);
    br =
        (0.9F + (ModLoader.getMinecraftInstance().gameSettings.gammaSetting * 0.1F))
            - (ModLoader.getMinecraftInstance().theWorld.calculateSkylightSubtracted(var2) * 0.03F);

    br *= ModLoader.getMinecraftInstance().theWorld.getSunBrightness(1F);

    // wave height darkening
    br = br - (height * 0.5F);

    if (br < 0.3F) br = 0.3F;

    float var16 =
        0.35F
            * br
            * (2F /* + ModLoader.getMinecraftInstance().gameSettings.gammaSetting*/); // mod_ExtendedRenderer.plBrightness * 0.0000001F;

    int var18 = 0;
    if (block != null) {
      var18 = block.colorMultiplier(entRef.worldObj, (int) renderX, (int) renderY, (int) renderZ);
    }

    this.red = (float) (var18 >> 16 & 255) / 255.0F;
    this.green = (float) (var18 >> 8 & 255) / 255.0F;
    this.blue = (float) (var18 & 255) / 255.0F;

    if (dim == WeatherUtil.tropiDimID) {
      green -= 0.3D;
    }

    // particleAlpha = 1F;

    // var16 = this.getBrightness(var2) * (1F +
    // ModLoader.getMinecraftInstance().gameSettings.gammaSetting);
    float vecX = (float) Math.sin(angle) * magnitude;
    float vecZ = (float) Math.cos(angle) * magnitude;
    float maxheight = ampheight;
    float adj = 0.5F;
    float adj2 = 1F;
    float adj3 = 1F;
    BlockDataGrid wg = WeatherMod.weatherMan.waterGrid;
    BlockDataPoint bdp;
    // xx -= 0.5F;
    // zz -= 0.5F;
    float height0 =
        ((float) Math.sin(waveTime - (xx - adj) * vecX - ((zz - adj) * vecZ)) + 1F)
            * magnitude
            * maxheight;
    float height1 =
        ((float) Math.sin(waveTime - (xx - adj) * vecX - ((zz + adj) * vecZ)) + 1F)
            * magnitude
            * maxheight;
    float height2 =
        ((float) Math.sin(waveTime - (xx + adj) * vecX - ((zz + adj) * vecZ)) + 1F)
            * magnitude
            * maxheight;
    float height3 =
        ((float) Math.sin(waveTime - (xx + adj) * vecX - ((zz - adj) * vecZ)) + 1F)
            * magnitude
            * maxheight;
    // xx += 1.5F;
    // zz -= 0.5F;
    float yy = renderY - 0.9F;
    boolean d = false;
    /*height0 = (float)Math.sqrt(wg.getPoint((int)(xx-adj2), (int)yy, (int)(zz)).height * wg.getPoint((int)(xx-adj2), (int)yy, (int)(zz)).height + wg.getPoint((int)(xx), (int)yy, (int)(zz-adj2)).height * wg.getPoint((int)(xx), (int)yy, (int)(zz-adj2)).height);
    height1 = (float)Math.sqrt(wg.getPoint((int)(xx-adj2), (int)yy, (int)(zz)).height * wg.getPoint((int)(xx-adj2), (int)yy, (int)(zz)).height + wg.getPoint((int)(xx), (int)yy, (int)(zz+adj2)).height * wg.getPoint((int)(xx), (int)yy, (int)(zz+adj2)).height);
    height2 = (float)Math.sqrt(wg.getPoint((int)(xx+adj2), (int)yy, (int)(zz)).height * wg.getPoint((int)(xx+adj2), (int)yy, (int)(zz)).height + wg.getPoint((int)(xx), (int)yy, (int)(zz+adj2)).height * wg.getPoint((int)(xx), (int)yy, (int)(zz+adj2)).height);
    height3 = (float)Math.sqrt(wg.getPoint((int)(xx+adj2), (int)yy, (int)(zz)).height * wg.getPoint((int)(xx+adj2), (int)yy, (int)(zz)).height + wg.getPoint((int)(xx), (int)yy, (int)(zz-adj2)).height * wg.getPoint((int)(xx), (int)yy, (int)(zz-adj2)).height);*/
    bdp = wg.getPoint((int) (xx), (int) yy, (int) (zz));

    // System.out.println(bdp.height);
    if (wg.getPoint((int) (xx - adj2), (int) yy, (int) (zz)).height == 0
        || wg.getPoint((int) (xx), (int) yy, (int) (zz - adj2)).height == 0
        ||
        /*wg.getPoint((int)(xx), (int)yy, (int)(zz+adj2)).height == 0 ||*/
        wg.getPoint((int) (xx - adj2), (int) yy, (int) (zz - adj2)).height == 0) {
      if (d) {
        System.out.print("0 - ");
      }

      height0 = 0;
    }

    if (d) {
      System.out.print("xx: " + (xx - adj2) + " - zz: " + (zz - adj2) + " - ");
    }

    // height0 = bdp.height;
    bdp = wg.getPoint((int) (xx - adj2), (int) yy, (int) (zz + adj2));

    if (wg.getPoint((int) (xx - adj2), (int) yy, (int) (zz)).height == 0
        || wg.getPoint((int) (xx), (int) yy, (int) (zz + adj2)).height == 0
        || wg.getPoint((int) (xx - adj2), (int) yy, (int) (zz + adj2)).height == 0) {
      if (d) {
        System.out.print("1 - ");
      }

      height1 = 0;
    }

    bdp = WeatherMod.weatherMan.waterGrid.getPoint((int) (xx + adj2), (int) yy, (int) (zz + adj2));

    if (wg.getPoint((int) (xx + adj2), (int) yy, (int) (zz)).height == 0
        || wg.getPoint((int) (xx), (int) yy, (int) (zz + adj2)).height == 0
        || wg.getPoint((int) (xx + adj2), (int) yy, (int) (zz + adj2)).height == 0) {
      if (d) {
        System.out.print("2 - ");
      }

      height2 = 0;
    }

    bdp = WeatherMod.weatherMan.waterGrid.getPoint((int) (xx + adj2), (int) yy, (int) (zz - adj2));

    if (wg.getPoint((int) (xx + adj2), (int) yy, (int) (zz)).height == 0
        || wg.getPoint((int) (xx), (int) yy, (int) (zz - adj2)).height == 0
        || wg.getPoint((int) (xx + adj2), (int) yy, (int) (zz - adj2)).height == 0) {
      if (d) {
        System.out.print("3 - ");
      }

      height3 = 0;
    }

    if (d) {
      System.out.print("| ");
    }

    // height0 = ((float)Math.sin(vecX*vecZ)) * magnitude * maxheight;
    // height0 = ((float)Math.sin(waveTime-xx*vecX-(zz*vecZ)) + 1F) * magnitude * maxheight;

    // height0 = height1 = height2 = height3 = 0F;

    if (ModLoader.getMinecraftInstance().objectMouseOver != null) {
      // System.out.println(ModLoader.getMinecraftInstance().objectMouseOver.blockX + " - " +
      // ModLoader.getMinecraftInstance().objectMouseOver.blockZ);
    }

    // var1.setColorOpaque_F(this.red * var16, this.green * var16, this.blue * var16);
    var1.setColorRGBA_F(
        this.red * var16, this.green * var16, this.blue * var16, Math.max(0F, particleAlpha));

    /*var1.addVertexWithUV((double)(var13 - var3 * var12 - var6 * var12), (double)(height0 + var14 - var4 * var12), (double)(var15 - var5 * var12 - var7 * var12), (double)var9, (double)var11);
    var1.addVertexWithUV((double)(var13 - var3 * var12 + var6 * var12), (double)(height1 + var14 + var4 * var12), (double)(var15 - var5 * var12 + var7 * var12), (double)var9, (double)var10);
    var1.addVertexWithUV((double)(var13 + var3 * var12 + var6 * var12), (double)(height2 + var14 + var4 * var12), (double)(var15 + var5 * var12 + var7 * var12), (double)var8, (double)var10);
    var1.addVertexWithUV((double)(var13 + var3 * var12 - var6 * var12), (double)(height3 + var14 - var4 * var12), (double)(var15 + var5 * var12 - var7 * var12), (double)var8, (double)var11);*/
    float f3 = icon.getMinU();
    float f4 = icon.getMaxU();
    float f5 = icon.getMinV();
    float f6 = icon.getMaxV();
    var1.addVertexWithUV(
        (double) (var13 - var3 * var12 - var6 * var12),
        (double) (height0 + var14 - var4 * var12),
        (double) (var15 - var5 * var12 - var7 * var12),
        (double) f3,
        (double) f6);
    var1.addVertexWithUV(
        (double) (var13 - var3 * var12 + var6 * var12),
        (double) (height1 + var14 + var4 * var12),
        (double) (var15 - var5 * var12 + var7 * var12),
        (double) f4,
        (double) f6);
    var1.addVertexWithUV(
        (double) (var13 + var3 * var12 + var6 * var12),
        (double) (height2 + var14 + var4 * var12),
        (double) (var15 + var5 * var12 + var7 * var12),
        (double) f4,
        (double) f5);
    var1.addVertexWithUV(
        (double) (var13 + var3 * var12 - var6 * var12),
        (double) (height3 + var14 - var4 * var12),
        (double) (var15 + var5 * var12 - var7 * var12),
        (double) f3,
        (double) f5);
    /*}
    }
    }*/
  }
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks rb) {
    Tessellator v5 = Tessellator.instance;
    int meta = world.getBlockMetadata(x, y, z);
    int color = b.colorMultiplier(world, x, y, z);
    float red = ReikaColorAPI.getRed(color) / 255F;
    float grn = ReikaColorAPI.getGreen(color) / 255F;
    float blu = ReikaColorAPI.getBlue(color) / 255F;
    rb.renderStandardBlockWithAmbientOcclusion(b, x, y, z, red, grn, blu);
    TileEntityColorLock te = (TileEntityColorLock) world.getTileEntity(x, y, z);

    if (!te.isHeldOpen()) {
      Collection<CrystalElement> c = te.getClosedColors();
      if (!c.isEmpty()) {
        v5.addTranslation(x, y, z);
        IIcon[] ico = new IIcon[] {ChromaIcons.BASICFADE.getIcon(), ChromaIcons.FRAME.getIcon()};
        int s = c.size();
        double iy = 0.0625;
        double dx = 0.0625;
        // s will never be more than 4
        double spc = 0.03125;
        double w = (1D - (dx * 2D) - spc * (s - 1)) / s;
        double sp = spc + w;
        double o = 0.005;
        for (CrystalElement e : c) {
          // if (!BlockColoredLock.isOpen(e, te.getChannel())) { does not work on servers
          for (int i = 0; i < ico.length; i++) {
            if (i == 0) {
              int clr =
                  ReikaColorAPI.getColorWithBrightnessMultiplier(
                      ReikaColorAPI.getModifiedSat(e.getColor(), 0.85F), 0.85F);
              v5.setColorRGBA_I(clr, 192);
              v5.setBrightness(240);
            } else {
              v5.setColorOpaque_I(0xffffff);
              v5.setBrightness(b.getMixedBrightnessForBlock(world, x, y, z));
            }

            for (int k = 0; k < 4; k++) {

              float u = ico[i].getMinU();
              float v = ico[i].getMinV();
              float du = ico[i].getMaxU();
              float dv = ico[i].getMaxV();

              if (k == 0 || k == 3) {
                float scr = v;
                v = dv;
                dv = scr;
              }

              switch (k) {
                case 0:
                  v5.addVertexWithUV(1 + o, dx, iy, du, v);
                  v5.addVertexWithUV(1 + o, dx + w, iy, u, v);
                  v5.addVertexWithUV(1 + o, dx + w, 1 - iy, u, dv);
                  v5.addVertexWithUV(1 + o, dx, 1 - iy, du, dv);
                  break;
                case 1:
                  v5.addVertexWithUV(1 - iy, dx, 1 + o, du, dv);
                  v5.addVertexWithUV(1 - iy, dx + w, 1 + o, u, dv);
                  v5.addVertexWithUV(iy, dx + w, 1 + o, u, v);
                  v5.addVertexWithUV(iy, dx, 1 + o, du, v);
                  break;
                case 2:
                  v5.addVertexWithUV(-o, dx, 1 - iy, du, dv);
                  v5.addVertexWithUV(-o, dx + w, 1 - iy, u, dv);
                  v5.addVertexWithUV(-o, dx + w, iy, u, v);
                  v5.addVertexWithUV(-o, dx, iy, du, v);
                  break;
                case 3:
                  v5.addVertexWithUV(iy, dx, -o, du, v);
                  v5.addVertexWithUV(iy, dx + w, -o, u, v);
                  v5.addVertexWithUV(1 - iy, dx + w, -o, u, dv);
                  v5.addVertexWithUV(1 - iy, dx, -o, du, dv);
                  break;
              }
            }
          }

          dx += sp;
          // }
        }
        v5.addTranslation(-x, -y, -z);
      }
    }

    return true;
  }
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    if (modelId == RENDER_ID) {
      final BlockBrewKettle brewKettle = (BlockBrewKettle) block;
      final double d = 0.0625D;
      float f = 1.0F;
      renderer.renderStandardBlock(block, x, y, z);
      final Tessellator tes = Tessellator.instance;
      tes.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
      int color = block.colorMultiplier(world, x, y, z);
      float r = (float) (color >> 16 & 255) / 255.0F;
      float g = (float) (color >> 8 & 255) / 255.0F;
      float b = (float) (color & 255) / 255.0F;
      float f4;

      if (EntityRenderer.anaglyphEnable) {
        final float f5 = (r * 30.0F + g * 59.0F + b * 11.0F) / 100.0F;
        f4 = (r * 30.0F + g * 70.0F) / 100.0F;
        final float f6 = (r * 30.0F + b * 70.0F) / 100.0F;
        r = f5;
        g = f4;
        b = f6;
      }

      tes.setColorOpaque_F(f * r, f * g, f * b);
      f4 = 0.125F;
      renderer.renderFaceXPos(
          block, (double) (x - 1.0F + f4), (double) y, (double) z, brewKettle.getIconByIndex(2));
      renderer.renderFaceXNeg(
          block, (double) (x + 1.0F - f4), (double) y, (double) z, brewKettle.getIconByIndex(2));
      renderer.renderFaceZPos(
          block, (double) x, (double) y, (double) (z - 1.0F + f4), brewKettle.getIconByIndex(2));
      renderer.renderFaceZNeg(
          block, (double) x, (double) y, (double) (z + 1.0F - f4), brewKettle.getIconByIndex(2));
      renderer.renderFaceYPos(
          block, (double) x, (double) (y - 1.0F + 0.25F), (double) z, brewKettle.getIconByIndex(1));
      renderer.renderFaceYNeg(
          block, (double) x, (double) (y + 1.0F - 0.75F), (double) z, brewKettle.getIconByIndex(1));

      // Render Liquid
      final TileEntityBrewKettle te = (TileEntityBrewKettle) world.getTileEntity(x, y, z);
      if (te != null) {
        for (int i = 0; i < 2; ++i) {
          if (te.isFluidTankFilled(i)) {
            final Fluid fluid = te.getFluid(i);
            color = fluid.getColor();
            r = (float) (color >> 16 & 255) / 255.0F;
            g = (float) (color >> 8 & 255) / 255.0F;
            b = (float) (color & 255) / 255.0F;
            f = 1.0F;
            tes.setColorOpaque_F(f * r, f * g, f * b);
            f = te.getFluidAmount(i) * FLUID_HEIGHT / te.getFluidTank(i).getCapacity();
            renderer.setRenderBounds(2 * d, 0.0D, 2 * d, 14 * d, (double) (0.25F + f), 14 * d);
            renderer.renderFaceYPos(block, (double) x, (double) y, (double) z, fluid.getIcon());
          }
        }
      }

      renderer.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
    }
    return true;
  }
Ejemplo n.º 8
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    if (!(block instanceof BlockFluidBase)) {
      return false;
    }

    Tessellator tessellator = Tessellator.instance;
    int color = block.colorMultiplier(world, x, y, z);
    float red = (color >> 16 & 255) / 255.0F;
    float green = (color >> 8 & 255) / 255.0F;
    float blue = (color & 255) / 255.0F;

    BlockFluidBase theFluid = (BlockFluidBase) block;
    int bMeta = world.getBlockMetadata(x, y, z);

    boolean renderTop = world.getBlock(x, y - theFluid.densityDir, z) != theFluid;

    boolean renderBottom =
        block.shouldSideBeRendered(world, x, y + theFluid.densityDir, z, 0)
            && world.getBlock(x, y + theFluid.densityDir, z) != theFluid;

    boolean[] renderSides =
        new boolean[] {
          block.shouldSideBeRendered(world, x, y, z - 1, 2),
          block.shouldSideBeRendered(world, x, y, z + 1, 3),
          block.shouldSideBeRendered(world, x - 1, y, z, 4),
          block.shouldSideBeRendered(world, x + 1, y, z, 5)
        };

    if (!renderTop
        && !renderBottom
        && !renderSides[0]
        && !renderSides[1]
        && !renderSides[2]
        && !renderSides[3]) {
      return false;
    } else {
      boolean rendered = false;
      double heightNW, heightSW, heightSE, heightNE;
      float flow11 = getFluidHeightForRender(world, x, y, z, theFluid);

      if (flow11 != 1) {
        float flow00 = getFluidHeightForRender(world, x - 1, y, z - 1, theFluid);
        float flow01 = getFluidHeightForRender(world, x - 1, y, z, theFluid);
        float flow02 = getFluidHeightForRender(world, x - 1, y, z + 1, theFluid);
        float flow10 = getFluidHeightForRender(world, x, y, z - 1, theFluid);
        float flow12 = getFluidHeightForRender(world, x, y, z + 1, theFluid);
        float flow20 = getFluidHeightForRender(world, x + 1, y, z - 1, theFluid);
        float flow21 = getFluidHeightForRender(world, x + 1, y, z, theFluid);
        float flow22 = getFluidHeightForRender(world, x + 1, y, z + 1, theFluid);

        heightNW = getFluidHeightAverage(new float[] {flow00, flow01, flow10, flow11});
        heightSW = getFluidHeightAverage(new float[] {flow01, flow02, flow12, flow11});
        heightSE = getFluidHeightAverage(new float[] {flow12, flow21, flow22, flow11});
        heightNE = getFluidHeightAverage(new float[] {flow10, flow20, flow21, flow11});
      } else {
        heightNW = flow11;
        heightSW = flow11;
        heightSE = flow11;
        heightNE = flow11;
      }

      boolean rises = theFluid.densityDir == 1;
      if (renderer.renderAllFaces || renderTop) {
        rendered = true;
        IIcon iconStill = getIcon(block.getIcon(1, bMeta));
        float flowDir = (float) BlockFluidBase.getFlowDirection(world, x, y, z);

        if (flowDir > -999.0F) {
          iconStill = getIcon(block.getIcon(2, bMeta));
        }

        heightNW -= RENDER_OFFSET;
        heightSW -= RENDER_OFFSET;
        heightSE -= RENDER_OFFSET;
        heightNE -= RENDER_OFFSET;

        double u1, u2, u3, u4, v1, v2, v3, v4;

        if (flowDir < -999.0F) {
          u2 = iconStill.getInterpolatedU(0.0D);
          v2 = iconStill.getInterpolatedV(0.0D);
          u1 = u2;
          v1 = iconStill.getInterpolatedV(16.0D);
          u4 = iconStill.getInterpolatedU(16.0D);
          v4 = v1;
          u3 = u4;
          v3 = v2;
        } else {
          float xFlow = MathHelper.sin(flowDir) * 0.25F;
          float zFlow = MathHelper.cos(flowDir) * 0.25F;
          u2 = iconStill.getInterpolatedU(8.0F + (-zFlow - xFlow) * 16.0F);
          v2 = iconStill.getInterpolatedV(8.0F + (-zFlow + xFlow) * 16.0F);
          u1 = iconStill.getInterpolatedU(8.0F + (-zFlow + xFlow) * 16.0F);
          v1 = iconStill.getInterpolatedV(8.0F + (zFlow + xFlow) * 16.0F);
          u4 = iconStill.getInterpolatedU(8.0F + (zFlow + xFlow) * 16.0F);
          v4 = iconStill.getInterpolatedV(8.0F + (zFlow - xFlow) * 16.0F);
          u3 = iconStill.getInterpolatedU(8.0F + (zFlow - xFlow) * 16.0F);
          v3 = iconStill.getInterpolatedV(8.0F + (-zFlow - xFlow) * 16.0F);
        }

        tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
        tessellator.setColorOpaque_F(LIGHT_Y_POS * red, LIGHT_Y_POS * green, LIGHT_Y_POS * blue);

        if (!rises) {
          tessellator.addVertexWithUV(x + 0, y + heightNW, z + 0, u2, v2);
          tessellator.addVertexWithUV(x + 0, y + heightSW, z + 1, u1, v1);
          tessellator.addVertexWithUV(x + 1, y + heightSE, z + 1, u4, v4);
          tessellator.addVertexWithUV(x + 1, y + heightNE, z + 0, u3, v3);
        } else {
          tessellator.addVertexWithUV(x + 1, y + 1 - heightNE, z + 0, u3, v3);
          tessellator.addVertexWithUV(x + 1, y + 1 - heightSE, z + 1, u4, v4);
          tessellator.addVertexWithUV(x + 0, y + 1 - heightSW, z + 1, u1, v1);
          tessellator.addVertexWithUV(x + 0, y + 1 - heightNW, z + 0, u2, v2);
        }
      }

      if (renderer.renderAllFaces || renderBottom) {
        rendered = true;
        tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y - 1, z));
        if (!rises) {
          tessellator.setColorOpaque_F(LIGHT_Y_NEG * red, LIGHT_Y_NEG * green, LIGHT_Y_NEG * blue);
          renderer.renderFaceYNeg(block, x, y + RENDER_OFFSET, z, getIcon(block.getIcon(0, bMeta)));
        } else {
          tessellator.setColorOpaque_F(LIGHT_Y_POS * red, LIGHT_Y_POS * green, LIGHT_Y_POS * blue);
          renderer.renderFaceYPos(block, x, y + RENDER_OFFSET, z, getIcon(block.getIcon(1, bMeta)));
        }
      }

      for (int side = 0; side < 4; ++side) {
        int x2 = x;
        int z2 = z;

        switch (side) {
          case 0:
            --z2;
            break;
          case 1:
            ++z2;
            break;
          case 2:
            --x2;
            break;
          case 3:
            ++x2;
            break;
        }

        IIcon iconFlow = getIcon(block.getIcon(side + 2, bMeta));
        if (renderer.renderAllFaces || renderSides[side]) {
          rendered = true;

          double ty1;
          double tx1;
          double ty2;
          double tx2;
          double tz1;
          double tz2;

          if (side == 0) {
            ty1 = heightNW;
            ty2 = heightNE;
            tx1 = x;
            tx2 = x + 1;
            tz1 = z + RENDER_OFFSET;
            tz2 = z + RENDER_OFFSET;
          } else if (side == 1) {
            ty1 = heightSE;
            ty2 = heightSW;
            tx1 = x + 1;
            tx2 = x;
            tz1 = z + 1 - RENDER_OFFSET;
            tz2 = z + 1 - RENDER_OFFSET;
          } else if (side == 2) {
            ty1 = heightSW;
            ty2 = heightNW;
            tx1 = x + RENDER_OFFSET;
            tx2 = x + RENDER_OFFSET;
            tz1 = z + 1;
            tz2 = z;
          } else {
            ty1 = heightNE;
            ty2 = heightSE;
            tx1 = x + 1 - RENDER_OFFSET;
            tx2 = x + 1 - RENDER_OFFSET;
            tz1 = z;
            tz2 = z + 1;
          }

          float u1Flow = iconFlow.getInterpolatedU(0.0D);
          float u2Flow = iconFlow.getInterpolatedU(8.0D);
          float v1Flow = iconFlow.getInterpolatedV((1.0D - ty1) * 16.0D * 0.5D);
          float v2Flow = iconFlow.getInterpolatedV((1.0D - ty2) * 16.0D * 0.5D);
          float v3Flow = iconFlow.getInterpolatedV(8.0D);
          tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x2, y, z2));
          float sideLighting = 1.0F;

          if (side < 2) {
            sideLighting = LIGHT_XZ_NEG;
          } else {
            sideLighting = LIGHT_XZ_POS;
          }

          tessellator.setColorOpaque_F(
              LIGHT_Y_POS * sideLighting * red,
              LIGHT_Y_POS * sideLighting * green,
              LIGHT_Y_POS * sideLighting * blue);

          if (!rises) {
            tessellator.addVertexWithUV(tx1, y + ty1, tz1, u1Flow, v1Flow);
            tessellator.addVertexWithUV(tx2, y + ty2, tz2, u2Flow, v2Flow);
            tessellator.addVertexWithUV(tx2, y + 0, tz2, u2Flow, v3Flow);
            tessellator.addVertexWithUV(tx1, y + 0, tz1, u1Flow, v3Flow);
          } else {
            tessellator.addVertexWithUV(tx1, y + 1 - 0, tz1, u1Flow, v3Flow);
            tessellator.addVertexWithUV(tx2, y + 1 - 0, tz2, u2Flow, v3Flow);
            tessellator.addVertexWithUV(tx2, y + 1 - ty2, tz2, u2Flow, v2Flow);
            tessellator.addVertexWithUV(tx1, y + 1 - ty1, tz1, u1Flow, v1Flow);
          }
        }
      }
      renderer.renderMinY = 0;
      renderer.renderMaxY = 1;
      return rendered;
    }
  }
  public void renderFallingCube(
      Structure var1, Block var2, World var3, int var4, int var5, int var6, int var7) {
    float var8 = 0.5F;
    float var9 = 1.0F;
    float var10 = 0.8F;
    float var11 = 0.6F;
    Tessellator var12 = Tessellator.instance;
    var12.startDrawingQuads();
    float var13 = var2.getBlockBrightness(var3, var4, var5, var6);
    float var14 = var2.getBlockBrightness(var3, var4, var5 - 1, var6);
    // var12.setBrightness(var2.getMixedBrightnessForBlock(var3, var4, var5, var6));

    if (var14 < var13) {;
    }

    var13 = 1.0F;
    var14 = 1.0F;
    float var15 = 1.0F;
    float var16 = 1.0F;
    float var17 = 1.0F;

    if (var2.blockID == Block.leaves.blockID) {
      int var18 = var2.colorMultiplier(var3, (int) var1.posX, (int) var1.posY, (int) var1.posZ);
      var15 = (float) (var18 >> 16 & 255) / 255.0F;
      var16 = (float) (var18 >> 8 & 255) / 255.0F;
      var17 = (float) (var18 & 255) / 255.0F;

      if (EntityRenderer.anaglyphEnable) {
        float var19 = (var15 * 30.0F + var16 * 59.0F + var17 * 11.0F) / 100.0F;
        float var20 = (var15 * 30.0F + var16 * 70.0F) / 100.0F;
        float var21 = (var15 * 30.0F + var17 * 70.0F) / 100.0F;
        var15 = var19;
        var16 = var20;
        var17 = var21;
      }
    }

    var12.setColorOpaque_F(var15 * var8 * var14, var16 * var8 * var14, var17 * var8 * var14);
    this.a.renderBottomFace(
        var2, -0.5D, -0.5D, -0.5D, var2.getBlockTextureFromSideAndMetadata(0, var7));

    if (var14 < var13) {
      var14 = var13;
    }

    var12.setColorOpaque_F(var15 * var9 * var14, var16 * var9 * var14, var17 * var9 * var14);
    this.a.renderTopFace(
        var2, -0.5D, -0.5D, -0.5D, var2.getBlockTextureFromSideAndMetadata(1, var7));

    if (var14 < var13) {
      var14 = var13;
    }

    var12.setColorOpaque_F(var15 * var10 * var14, var16 * var10 * var14, var17 * var10 * var14);
    this.a.renderEastFace(
        var2, -0.5D, -0.5D, -0.5D, var2.getBlockTextureFromSideAndMetadata(2, var7));

    if (var14 < var13) {
      var14 = var13;
    }

    var12.setColorOpaque_F(var15 * var10 * var14, var16 * var10 * var14, var17 * var10 * var14);
    this.a.renderWestFace(
        var2, -0.5D, -0.5D, -0.5D, var2.getBlockTextureFromSideAndMetadata(3, var7));

    if (var14 < var13) {
      var14 = var13;
    }

    var12.setColorOpaque_F(var15 * var11 * var14, var16 * var11 * var14, var17 * var11 * var14);
    this.a.renderNorthFace(
        var2, -0.5D, -0.5D, -0.5D, var2.getBlockTextureFromSideAndMetadata(4, var7));

    if (var14 < var13) {
      var14 = var13;
    }

    var12.setColorOpaque_F(var15 * var11 * var14, var16 * var11 * var14, var17 * var11 * var14);
    this.a.renderSouthFace(
        var2, -0.5D, -0.5D, -0.5D, var2.getBlockTextureFromSideAndMetadata(5, var7));
    var12.draw();
  }