/**
  * Sets the RGB values as specified, converting from floats between 0 and 1 to integers from
  * 0-255.
  */
 public void setColorOpaque_F(float par1, float par2, float par3) {
   setColorOpaque((int) (par1 * 255F), (int) (par2 * 255F), (int) (par3 * 255F));
 }
 /** Sets the color to the given opaque value (stored as byte values packed in an integer). */
 public void setColorOpaque_I(int par1) {
   int i = par1 >> 16 & 0xff;
   int j = par1 >> 8 & 0xff;
   int k = par1 & 0xff;
   setColorOpaque(i, j, k);
 }
  public void renderPiston(
      TileEntityPiston par1TileEntityPiston, double par2, double par4, double par6, float par8) {
    Block block = Block.blocksList[par1TileEntityPiston.getStoredBlockID()];

    if (block != null && par1TileEntityPiston.getProgress(par8) < 1.0F) {
      Tessellator tessellator = Tessellator.instance;
      bindTextureByName("/terrain.png");
      RenderHelper.disableStandardItemLighting();
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      GL11.glEnable(GL11.GL_BLEND);
      GL11.glDisable(GL11.GL_CULL_FACE);

      if (Minecraft.isAmbientOcclusionEnabled()) {
        GL11.glShadeModel(GL11.GL_SMOOTH);
      } else {
        GL11.glShadeModel(GL11.GL_FLAT);
      }

      tessellator.startDrawingQuads();
      tessellator.setTranslation(
          ((float) par2 - par1TileEntityPiston.xCoord) + par1TileEntityPiston.getOffsetX(par8),
          ((float) par4 - par1TileEntityPiston.yCoord) + par1TileEntityPiston.getOffsetY(par8),
          ((float) par6 - par1TileEntityPiston.zCoord) + par1TileEntityPiston.getOffsetZ(par8));
      tessellator.setColorOpaque(1, 1, 1);

      if (block == Block.pistonExtension && par1TileEntityPiston.getProgress(par8) < 0.5F) {
        this.blockRenderer.renderPistonExtensionAllFaces(
            block,
            par1TileEntityPiston.xCoord,
            par1TileEntityPiston.yCoord,
            par1TileEntityPiston.zCoord,
            false);
      } else if (par1TileEntityPiston.shouldRenderHead() && !par1TileEntityPiston.isExtending()) {
        Block.pistonExtension.setHeadTexture(((BlockPistonBase) block).getPistonExtensionTexture());
        this.blockRenderer.renderPistonExtensionAllFaces(
            Block.pistonExtension,
            par1TileEntityPiston.xCoord,
            par1TileEntityPiston.yCoord,
            par1TileEntityPiston.zCoord,
            par1TileEntityPiston.getProgress(par8) < 0.5F);
        Block.pistonExtension.clearHeadTexture();
        tessellator.setTranslation(
            (float) par2 - par1TileEntityPiston.xCoord,
            (float) par4 - par1TileEntityPiston.yCoord,
            (float) par6 - par1TileEntityPiston.zCoord);
        this.blockRenderer.renderPistonBaseAllFaces(
            block,
            par1TileEntityPiston.xCoord,
            par1TileEntityPiston.yCoord,
            par1TileEntityPiston.zCoord);
      } else {
        this.blockRenderer.renderBlockAllFaces(
            block,
            par1TileEntityPiston.xCoord,
            par1TileEntityPiston.yCoord,
            par1TileEntityPiston.zCoord);
      }

      tessellator.setTranslation(0.0D, 0.0D, 0.0D);
      tessellator.draw();
      RenderHelper.enableStandardItemLighting();
    }
  }