Beispiel #1
0
  @Nonnull
  private static List<TextureDetails> getIcons(Block block, int meta, ItemBlock itemBlock) {
    TextureDetails any = null;
    TextureDetails top = null;
    TextureDetails side = null;

    int col = itemBlock.getColorFromItemStack(new ItemStack(itemBlock, 1, meta), 0);

    TextureDetails[] icons = new TextureDetails[6];

    for (int s = 0; s < 6; s++) {
      String iconName = null;
      if (meta == OreDictionary.WILDCARD_VALUE) {
        for (int i = 0; i < 16; i++) {
          try {
            iconName = getIconName(block.getIcon(s, meta));
          } catch (Throwable err) {
            continue;
          }
          if (iconName != null) break;
        }
      } else
        try {
          iconName = getIconName(block.getIcon(s, meta));
        } catch (Throwable err) {
          continue;
        }

      if (iconName == null) continue;

      TextureDetails textureDetails = TextureDetails.createTextureDetails(iconName, col, 0);

      icons[s] = textureDetails;
      if (any == null) any = textureDetails;
      if (s < 2) {
        if (top == null) top = textureDetails;
      } else {
        if (side == null) side = textureDetails;
      }
    }

    if (any == null) return ImmutableList.of();

    for (int i = 0; i < icons.length; i++) {
      if (icons[i] != null) continue;
      if (i < 2 && top != null) icons[i] = top;
      else if (i >= 2 && side != null) icons[i] = side;
      else icons[i] = any;
    }

    return Lists.newArrayList(icons);
  }
  public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    Tessellator tessellator = Tessellator.instance;
    block.setBlockBoundsForItemRender();
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -1.0F, 0.0F);
    renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, metadata));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, metadata));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    tessellator.addTranslation(0.0F, 0.0F, 0.0F);
    renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, metadata));
    tessellator.addTranslation(0.0F, 0.0F, 0.0F);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    tessellator.addTranslation(0.0F, 0.0F, 0.0F);
    renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, metadata));
    tessellator.addTranslation(0.0F, 0.0F, 0.0F);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    tessellator.addTranslation(0.0F, 0.0F, 0.0F);

    tessellator.setBrightness(15 << 20 | 15 << 6);
    tessellator.setColorRGBA_I(0xFFFFFF, 0xFF);
    int[] color = {0x1B2344, 0x895CA8, 0xDABDEF};
    BlockTerminalFluid terminal = (BlockTerminalFluid) block;
    renderer.renderFaceXNeg(block, 0, 0, 0, terminal.baseLayer);
    for (int i = 0; i < 3; i++) {
      tessellator.setColorRGBA_I(color[i], 0xFF);
      renderer.renderFaceXNeg(block, 0, 0, 0, terminal.colorLayers[i]);
    }

    tessellator.addTranslation(0.0F, 0.0F, 0.0F);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    tessellator.addTranslation(0.0F, 0.0F, 0.0F);
    renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, metadata));
    tessellator.addTranslation(0.0F, 0.0F, 0.0F);
    tessellator.draw();

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
  }
  @Override
  public void renderInventoryBlock(
      Block block, int metadata, int modelID, RenderBlocks renderBlocks) {

    Tessellator tessellator = Tessellator.instance;
    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    renderBlocks.setRenderBounds(0, 0, 0, 1.0D, 1.0D, 1.0D);

    tessellator.startDrawing(TRIANGLES);
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    HelperOrthoWedge.renderFaceZNeg(
        renderBlocks,
        Slope.ID_WEDGE_POS_W,
        0.0D,
        0.0D,
        0.0D,
        block.getIcon(2, EventHandler.BLOCKICON_BASE_ID));
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    HelperOrthoWedge.renderFaceZPos(
        renderBlocks,
        Slope.ID_WEDGE_POS_W,
        0.0D,
        0.0D,
        0.0D,
        block.getIcon(2, EventHandler.BLOCKICON_BASE_ID));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -1.0F, 0.0F);
    RenderHelper.renderFaceYNeg(
        renderBlocks, 0.0D, 0.0D, 0.0D, block.getIcon(0, EventHandler.BLOCKICON_BASE_ID));
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    RenderHelper.renderFaceXPos(
        renderBlocks, 0.0D, 0.0D, 0.0D, block.getIcon(2, EventHandler.BLOCKICON_BASE_ID));
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    HelperOblWedge.renderSlopeXNeg(
        renderBlocks,
        Slope.ID_WEDGE_POS_W,
        0.0D,
        0.0D,
        0.0D,
        block.getIcon(1, EventHandler.BLOCKICON_BASE_ID));
    tessellator.draw();

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
  }
Beispiel #4
0
 @SideOnly(Side.CLIENT)
 public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
   TileEntityCamoMine te = (TileEntityCamoMine) world.getTileEntity(x, y, z);
   ItemStack stack = te.getCamouflage(side);
   if (stack != null && stack.getItem() instanceof ItemBlock) {
     Block block = ((ItemBlock) stack.getItem()).field_150939_a;
     return block.getIcon(side, stack.getItemDamage());
   } else {
     return super.getIcon(world, x, y, z, side);
   }
 }
  public Icon getParticleTextureIndex(int dim, Block block) {

    return block.getIcon(1, 0);

    /*if (dim == 0) {
    	return Block.waterStill.getIcon(1, 0);
    } else if (dim == 127) {
    	return TropicraftMod.waterStillTropics.getIcon(1, 0);
    } else {
    	return Block.waterStill.getIcon(1, 0);
    }*/
  }
 private void renderStandardBlock(Block block, int meta, RenderBlocks renderer) {
   Tessellator tessellator = Tessellator.instance;
   GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, -1.0F, 0.0F);
   renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 1.0F, 0.0F);
   renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 0.0F, -1.0F);
   renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 0.0F, 1.0F);
   renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(-1.0F, 0.0F, 0.0F);
   renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(1.0F, 0.0F, 0.0F);
   renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
   tessellator.draw();
   GL11.glTranslatef(0.5F, 0.5F, 0.5F);
 }
Beispiel #7
0
 public static void renderInvBlock(Block block, int m, RenderBlocks renderer) {
   Tessellator var14 = Tessellator.instance;
   GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
   var14.startDrawingQuads();
   var14.setNormal(0.0F, -1.0F, 0.0F);
   renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, m));
   var14.draw();
   var14.startDrawingQuads();
   var14.setNormal(0.0F, 1.0F, 0.0F);
   renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, m));
   var14.draw();
   var14.startDrawingQuads();
   var14.setNormal(0.0F, 0.0F, -1.0F);
   renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, m));
   var14.draw();
   var14.startDrawingQuads();
   var14.setNormal(0.0F, 0.0F, 1.0F);
   renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, m));
   var14.draw();
   var14.startDrawingQuads();
   var14.setNormal(-1.0F, 0.0F, 0.0F);
   renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, m));
   var14.draw();
   var14.startDrawingQuads();
   var14.setNormal(1.0F, 0.0F, 0.0F);
   renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, m));
   var14.draw();
   GL11.glTranslatef(0.5F, 0.5F, 0.5F);
 }
Beispiel #8
0
 private void renderInInventory(
     Tessellator tessellator, RenderBlocks renderer, Block block, int metadata) {
   GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, -1F, 0.0F);
   renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, metadata));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 1.0F, 0.0F);
   renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, metadata));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 0.0F, -1F);
   renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, metadata));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 0.0F, 1.0F);
   renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, metadata));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(-1F, 0.0F, 0.0F);
   renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, metadata));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(1.0F, 0.0F, 0.0F);
   renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, metadata));
   tessellator.draw();
   GL11.glTranslatef(0.5F, 0.5F, 0.5F);
 }
 private static void renderStandardBlock(RenderBlocks var0, Block var1, int var2) {
   GL11.glPushMatrix();
   final Tessellator var3 = Tessellator.instance;
   GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
   GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
   var3.startDrawingQuads();
   var3.setNormal(0.0F, -1.0F, 0.0F);
   var0.renderFaceYNeg(var1, 0.0D, 0.0D, 0.0D, var1.getIcon(0, var2));
   var3.draw();
   var3.startDrawingQuads();
   var3.setNormal(0.0F, 1.0F, 0.0F);
   var0.renderFaceYPos(var1, 0.0D, 0.0D, 0.0D, var1.getIcon(1, var2));
   var3.draw();
   var3.startDrawingQuads();
   var3.setNormal(0.0F, 0.0F, -1.0F);
   var0.renderFaceXPos(var1, 0.0D, 0.0D, 0.0D, var1.getIcon(2, var2));
   var3.draw();
   var3.startDrawingQuads();
   var3.setNormal(0.0F, 0.0F, 1.0F);
   var0.renderFaceXNeg(var1, 0.0D, 0.0D, 0.0D, var1.getIcon(3, var2));
   var3.draw();
   var3.startDrawingQuads();
   var3.setNormal(-1.0F, 0.0F, 0.0F);
   var0.renderFaceZNeg(var1, 0.0D, 0.0D, 0.0D, var1.getIcon(4, var2));
   var3.draw();
   var3.startDrawingQuads();
   var3.setNormal(1.0F, 0.0F, 0.0F);
   var0.renderFaceZPos(var1, 0.0D, 0.0D, 0.0D, var1.getIcon(5, var2));
   var3.draw();
   GL11.glPopMatrix();
 }
Beispiel #10
0
  public static void drawBlock(Block block, int meta, RenderBlocks renderer) {
    Tessellator tessellator = Tessellator.instance;

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -1.0F, 0.0F);
    renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
    tessellator.draw();
  }
 @SideOnly(Side.CLIENT)
 public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
   if (blockAccess.getTileEntity(x, y, z) instanceof TileEntityDisguiseBlock) {
     TileEntityDisguiseBlock te = (TileEntityDisguiseBlock) blockAccess.getTileEntity(x, y, z);
     if (te != null) {
       Block block = te.getBlock();
       if (block != null) {
         return block.getIcon(side, te.getMetadata());
       }
     }
   }
   return blockIcon;
 }
  @Override
  /** Override to provide custom icons. */
  protected Icon getUniqueIcon(Block block, int side, Icon icon) {
    if (isSideSloped) {
      Slope slope = Slope.slopesList[BlockProperties.getData(TE)];
      int metadata = BlockProperties.getCoverMetadata(TE, coverRendering);

      /* Uncovered sloped oblique faces use triangular frame icons. */
      if (!BlockProperties.hasCover(TE, 6)) {
        if (slope.type.equals(Type.OBLIQUE_INT)) {
          icon =
              slope.isPositive
                  ? IconRegistry.icon_slope_oblique_pt_low
                  : IconRegistry.icon_slope_oblique_pt_high;
        } else if (slope.type.equals(Type.OBLIQUE_EXT)) {
          icon =
              slope.isPositive
                  ? IconRegistry.icon_slope_oblique_pt_high
                  : IconRegistry.icon_slope_oblique_pt_low;
        }
      }

      /* For directional blocks, make sure sloped icons match regardless of side. */
      if (BlockProperties.blockRotates(TE.worldObj, block, TE.xCoord, TE.yCoord, TE.zCoord)) {
        if (metadata % 8 == 0) {
          icon = block.getIcon(slope.isPositive ? 1 : 0, metadata);
        } else {
          icon = block.getIcon(2, metadata);
        }
      } else if (block instanceof BlockDirectional && !slope.type.equals(Type.WEDGE_Y)) {
        icon = block.getBlockTextureFromSide(1);
      }
    }

    return icon;
  }
  @Override
  public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {

    if (block.getRenderType() == BuildCraftCore.blockByEntityModel) {

      EntityRenderIndex index = new EntityRenderIndex(block, metadata);
      if (blockByEntityRenders.containsKey(index)) {
        blockByEntityRenders.get(index).inventoryRender(-0.5, -0.5, -0.5, 0, 0);
      }

    } else if (block.getRenderType() == BuildCraftCore.legacyPipeModel) {
      Tessellator tessellator = Tessellator.instance;

      block.setBlockBounds(
          CoreConstants.PIPE_MIN_POS,
          0.0F,
          CoreConstants.PIPE_MIN_POS,
          CoreConstants.PIPE_MAX_POS,
          1.0F,
          CoreConstants.PIPE_MAX_POS);
      renderer.setRenderBoundsFromBlock(block);
      block.setBlockBoundsForItemRender();
      GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
      tessellator.startDrawingQuads();
      tessellator.setNormal(0.0F, -1F, 0.0F);
      renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, metadata));
      tessellator.draw();
      tessellator.startDrawingQuads();
      tessellator.setNormal(0.0F, 1.0F, 0.0F);
      renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, metadata));
      tessellator.draw();
      tessellator.startDrawingQuads();
      tessellator.setNormal(0.0F, 0.0F, -1F);
      renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, metadata));
      tessellator.draw();
      tessellator.startDrawingQuads();
      tessellator.setNormal(0.0F, 0.0F, 1.0F);
      renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, metadata));
      tessellator.draw();
      tessellator.startDrawingQuads();
      tessellator.setNormal(-1F, 0.0F, 0.0F);
      renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, metadata));
      tessellator.draw();
      tessellator.startDrawingQuads();
      tessellator.setNormal(1.0F, 0.0F, 0.0F);
      renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, metadata));
      tessellator.draw();
      GL11.glTranslatef(0.5F, 0.5F, 0.5F);
      block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
    }
  }
 public EntityDiggingFX(
     World par1World,
     double par2,
     double par4,
     double par6,
     double par8,
     double par10,
     double par12,
     Block par14Block,
     int par15,
     int side) {
   super(par1World, par2, par4, par6, par8, par10, par12);
   this.blockInstance = par14Block;
   this.func_110125_a(par14Block.getIcon(side, par15));
   this.particleGravity = par14Block.blockParticleGravity;
   this.particleRed = this.particleGreen = this.particleBlue = 0.6F;
   this.particleScale /= 2.0F;
   this.side = side;
 }
Beispiel #15
0
  @SideOnly(Side.CLIENT)
  @Override
  public boolean addBlockHitEffects(
      World world, MovingObjectPosition target, EffectRenderer effectRenderer) {
    Icon tex = null;

    TileEntityCustomBlock cb =
        (TileEntityCustomBlock)
            world.getBlockTileEntity(target.blockX, target.blockY, target.blockZ);
    Block b = cb.getSourceBlock();
    if (b != null) {
      tex = b.getIcon(ForgeDirection.NORTH.ordinal(), cb.getSourceBlockMetadata());
    }
    if (tex == null) {
      tex = blockIcon;
    }
    lastRemovedComponetIcon = tex;
    addBlockHitEffects(
        world, effectRenderer, target.blockX, target.blockY, target.blockZ, target.sideHit, tex);
    return true;
  }
Beispiel #16
0
  @Override
  public Icon getIcon(ItemStack stack, int pass) {

    String iconKey = data.getIcon(stack, pass);

    if (iconKey == null) return getBoxIcon();

    if (iconKey.startsWith(BaseBlock.BLOCK_PREFIX)) {
      String[] parts = iconKey.split("x");
      int blockID = Integer.valueOf(parts[1]);
      int blockMeta = Integer.valueOf(parts[2]);

      Block block = BlockItemUtil.getBlockByID(blockID);
      if (block == null) return getBoxIcon();

      return block.getIcon(pass, blockMeta);
    }

    return TextureMapper.iconMap.get(iconKey);

    //		return TextureMapper.iconMap.get(data.getIcon(stack, pass));
  }
  @Override
  public void renderInventoryBlock(Block b, int metadata, int modelId, RenderBlocks rb) {
    Tessellator v5 = Tessellator.instance;

    rb.renderMaxX = 1;
    rb.renderMinY = 0;
    rb.renderMaxZ = 1;
    rb.renderMinX = 0;
    rb.renderMinZ = 0;
    rb.renderMaxY = 1;

    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    v5.startDrawingQuads();
    v5.setNormal(0.0F, -1.0F, 0.0F);
    rb.renderFaceYNeg(b, 0.0D, 0.0D, 0.0D, b.getIcon(0, metadata));
    v5.draw();

    v5.startDrawingQuads();
    v5.setNormal(0.0F, 1.0F, 0.0F);
    rb.renderFaceYPos(b, 0.0D, 0.0D, 0.0D, b.getIcon(1, metadata));
    v5.draw();

    v5.startDrawingQuads();
    v5.setNormal(0.0F, 0.0F, -1.0F);
    rb.renderFaceZNeg(b, 0.0D, 0.0D, 0.0D, b.getIcon(2, metadata));
    v5.draw();
    v5.startDrawingQuads();
    v5.setNormal(0.0F, 0.0F, 1.0F);
    rb.renderFaceZPos(b, 0.0D, 0.0D, 0.0D, b.getIcon(3, metadata));
    v5.draw();
    v5.startDrawingQuads();
    v5.setNormal(-1.0F, 0.0F, 0.0F);
    rb.renderFaceXNeg(b, 0.0D, 0.0D, 0.0D, b.getIcon(4, metadata));
    v5.draw();
    v5.startDrawingQuads();
    v5.setNormal(1.0F, 0.0F, 0.0F);
    rb.renderFaceXPos(b, 0.0D, 0.0D, 0.0D, b.getIcon(5, metadata));
    v5.draw();

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
  }
  @Override
  public void renderInventoryBlock(Block b, int metadata, int modelId, RenderBlocks rb) {
    Tessellator tessellator = Tessellator.instance;

    rb.renderMaxX = 1;
    rb.renderMinY = 0;
    rb.renderMaxZ = 1;
    rb.renderMinX = 0;
    rb.renderMinZ = 0;
    rb.renderMaxY = 1;

    IIcon ico = b.getIcon(0, metadata);

    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -1.0F, 0.0F);
    rb.renderFaceYNeg(b, 0.0D, 0.0D, 0.0D, ico);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    rb.renderFaceYPos(b, 0.0D, 0.0D, 0.0D, ico);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    rb.renderFaceZNeg(b, 0.0D, 0.0D, 0.0D, ico);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    rb.renderFaceZPos(b, 0.0D, 0.0D, 0.0D, ico);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    rb.renderFaceXNeg(b, 0.0D, 0.0D, 0.0D, ico);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    rb.renderFaceXPos(b, 0.0D, 0.0D, 0.0D, ico);
    tessellator.draw();

    ico = CrystalElement.elements[metadata].getFaceRune();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -1.0F, 0.0F);
    rb.renderFaceYNeg(b, 0.0D, 0.0D, 0.0D, ico);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    rb.renderFaceYPos(b, 0.0D, 0.0D, 0.0D, ico);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    rb.renderFaceZNeg(b, 0.0D, 0.0D, 0.0D, ico);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    rb.renderFaceZPos(b, 0.0D, 0.0D, 0.0D, ico);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    rb.renderFaceXNeg(b, 0.0D, 0.0D, 0.0D, ico);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    rb.renderFaceXPos(b, 0.0D, 0.0D, 0.0D, ico);
    tessellator.draw();

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
  }
  @Override
  public void renderInventoryBlock(Block b, int metadata, int modelId, RenderBlocks rb) {
    Tessellator v5 = Tessellator.instance;

    rb.renderMaxX = 1;
    rb.renderMinY = 0;
    rb.renderMaxZ = 1;
    rb.renderMinX = 0;
    rb.renderMinZ = 0;
    rb.renderMaxY = 1;

    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    v5.startDrawingQuads();
    v5.setNormal(0.0F, -1.0F, 0.0F);
    rb.renderFaceYNeg(b, 0.0D, 0.0D, 0.0D, b.getIcon(0, metadata));
    v5.draw();

    v5.startDrawingQuads();
    v5.setNormal(0.0F, 1.0F, 0.0F);
    rb.renderFaceYPos(b, 0.0D, 0.0D, 0.0D, b.getIcon(1, metadata));
    v5.draw();

    v5.startDrawingQuads();
    v5.setNormal(0.0F, 0.0F, -1.0F);
    rb.renderFaceZNeg(b, 0.0D, 0.0D, 0.0D, b.getIcon(2, metadata));
    v5.draw();
    v5.startDrawingQuads();
    v5.setNormal(0.0F, 0.0F, 1.0F);
    rb.renderFaceZPos(b, 0.0D, 0.0D, 0.0D, b.getIcon(3, metadata));
    v5.draw();
    v5.startDrawingQuads();
    v5.setNormal(-1.0F, 0.0F, 0.0F);
    rb.renderFaceXNeg(b, 0.0D, 0.0D, 0.0D, b.getIcon(4, metadata));
    v5.draw();
    v5.startDrawingQuads();
    v5.setNormal(1.0F, 0.0F, 0.0F);
    rb.renderFaceXPos(b, 0.0D, 0.0D, 0.0D, b.getIcon(5, metadata));
    v5.draw();

    LightedTreeBlock ltb = (LightedTreeBlock) b;
    IIcon ico = ltb.getOverlay(metadata);
    if (ltb.renderOverlayOnSide(0, metadata)) {
      v5.startDrawingQuads();
      v5.setColorOpaque_I(0xffffff);
      v5.setBrightness(240);
      v5.setNormal(0.0F, -1.0F, 0.0F);
      rb.renderFaceYNeg(b, 0.0D, 0.0D, 0.0D, ico);
      v5.draw();
    }

    if (ltb.renderOverlayOnSide(1, metadata)) {
      v5.startDrawingQuads();
      v5.setColorOpaque_I(0xffffff);
      v5.setBrightness(240);
      v5.setNormal(0.0F, 1.0F, 0.0F);
      rb.renderFaceYPos(b, 0.0D, 0.0D, 0.0D, ico);
      v5.draw();
    }

    if (ltb.renderOverlayOnSide(2, metadata)) {
      v5.startDrawingQuads();
      v5.setColorOpaque_I(0xffffff);
      v5.setBrightness(240);
      v5.setNormal(0.0F, 0.0F, -1.0F);
      rb.renderFaceZNeg(b, 0.0D, 0.0D, 0.0D, ico);
      v5.draw();
    }

    if (ltb.renderOverlayOnSide(3, metadata)) {
      v5.startDrawingQuads();
      v5.setColorOpaque_I(0xffffff);
      v5.setBrightness(240);
      v5.setNormal(0.0F, 0.0F, 1.0F);
      rb.renderFaceZPos(b, 0.0D, 0.0D, 0.0D, ico);
      v5.draw();
    }

    if (ltb.renderOverlayOnSide(4, metadata)) {
      v5.startDrawingQuads();
      v5.setColorOpaque_I(0xffffff);
      v5.setBrightness(240);
      v5.setNormal(-1.0F, 0.0F, 0.0F);
      rb.renderFaceXNeg(b, 0.0D, 0.0D, 0.0D, ico);
      v5.draw();
    }

    if (ltb.renderOverlayOnSide(5, metadata)) {
      v5.startDrawingQuads();
      v5.setColorOpaque_I(0xffffff);
      v5.setBrightness(240);
      v5.setNormal(1.0F, 0.0F, 0.0F);
      rb.renderFaceXPos(b, 0.0D, 0.0D, 0.0D, ico);
      v5.draw();
    }

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
  }
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_fence) {
      renderer.setRenderBounds(.375, 0, .375, .625, 1, .625);
      renderer.renderStandardBlock(block, x, y, z);
      BlockMetalDecoration md = (BlockMetalDecoration) block;

      if (md.canConnectFenceTo(world, x + 1, y, z)) {
        renderer.setRenderBounds(.625, .375, .4375, 1, .5625, .5625);
        renderer.renderStandardBlock(block, x, y, z);
        renderer.setRenderBounds(.625, .75, .4375, 1, .9375, .5625);
        renderer.renderStandardBlock(block, x, y, z);
      }
      if (md.canConnectFenceTo(world, x - 1, y, z)) {
        renderer.setRenderBounds(0, .375, .4375, .375, .5625, .5625);
        renderer.renderStandardBlock(block, x, y, z);
        renderer.setRenderBounds(0, .75, .4375, .375, .9375, .5625);
        renderer.renderStandardBlock(block, x, y, z);
      }
      if (md.canConnectFenceTo(world, x, y, z + 1)) {
        renderer.setRenderBounds(.4375, .375, .625, .5625, .5625, 1);
        renderer.renderStandardBlock(block, x, y, z);
        renderer.setRenderBounds(.4375, .75, .625, .5625, .9375, 1);
        renderer.renderStandardBlock(block, x, y, z);
      }
      if (md.canConnectFenceTo(world, x, y, z - 1)) {
        renderer.setRenderBounds(.4375, .375, 0, .5625, .5625, .375);
        renderer.renderStandardBlock(block, x, y, z);
        renderer.setRenderBounds(.4375, .75, 0, .5625, .9375, .375);
        renderer.renderStandardBlock(block, x, y, z);
      }
      return true;
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_scaffolding) {
      renderer.setRenderBoundsFromBlock(block);
      float f = .015625f;
      float f1 = 0;
      renderer.renderFromInside = true;
      renderer.renderMinX += block.shouldSideBeRendered(world, x - 1, y, z, 4) ? f : f1;
      renderer.renderMinY += block.shouldSideBeRendered(world, x, y - 1, z, 0) ? f : f1;
      renderer.renderMinZ += block.shouldSideBeRendered(world, x, y, z - 1, 2) ? f : f1;
      renderer.renderMaxX -= block.shouldSideBeRendered(world, x + 1, y, z, 5) ? f : f1;
      renderer.renderMaxY -= block.shouldSideBeRendered(world, x, y + 1, z, 1) ? f : f1;
      renderer.renderMaxZ -= block.shouldSideBeRendered(world, x, y, z + 1, 3) ? f : f1;
      renderer.renderStandardBlock(block, x, y, z);
      renderer.renderMinX -= block.shouldSideBeRendered(world, x - 1, y, z, 4) ? f : f1;
      renderer.renderMinY -= block.shouldSideBeRendered(world, x, y - 1, z, 0) ? f : f1;
      renderer.renderMinZ -= block.shouldSideBeRendered(world, x, y, z - 1, 2) ? f : f1;
      renderer.renderMaxX += block.shouldSideBeRendered(world, x + 1, y, z, 5) ? f : f1;
      renderer.renderMaxY += block.shouldSideBeRendered(world, x, y + 1, z, 1) ? f : f1;
      renderer.renderMaxZ += block.shouldSideBeRendered(world, x, y, z + 1, 3) ? f : f1;
      renderer.renderFromInside = false;
      return renderer.renderStandardBlock(block, x, y, z);
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_lantern)
    //		{
    //			if(world.isAirBlock(x,y-1,z)&&!world.isAirBlock(x,y+1,z))
    //			{
    //				renderer.uvRotateWest = 3;
    //				renderer.uvRotateEast = 3;
    //				renderer.uvRotateNorth = 3;
    //				renderer.uvRotateSouth = 3;
    //				renderer.setRenderBounds(.3125f,.875f,.3125f, .6875f,1,.6875f);
    //				renderer.renderStandardBlock(block, x, y, z);
    //				renderer.setRenderBounds(.25f,.1875f,.25f, .75f,.875f,.75f);
    //				renderer.renderStandardBlock(block, x, y, z);
    //				renderer.uvRotateWest = 0;
    //				renderer.uvRotateEast = 0;
    //				renderer.uvRotateNorth = 0;
    //				renderer.uvRotateSouth = 0;
    //			}
    //			else
    //			{
    //				renderer.setRenderBounds(.3125f,0,.3125f, .6875f,.125f,.6875f);
    //				renderer.renderStandardBlock(block, x, y, z);
    //				renderer.setRenderBounds(.25f,.125f,.25f, .75f,.8125f,.75f);
    //				renderer.renderStandardBlock(block, x, y, z);
    //			}
    //			return true;
    //		}
    {
      TileEntityLantern tile = (TileEntityLantern) world.getTileEntity(x, y, z);
      ClientUtils.handleStaticTileRenderer(tile);
      return true;
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_structuralArm) {
      Tessellator tes = ClientUtils.tes();
      IIcon iSide = block.getIcon(2, 3);
      IIcon iTop = block.getIcon(0, 3);

      int f =
          (world.getTileEntity(x, y, z) instanceof TileEntityStructuralArm)
              ? ((TileEntityStructuralArm) world.getTileEntity(x, y, z)).facing
              : 0;
      boolean inv =
          (world.getTileEntity(x, y, z) instanceof TileEntityStructuralArm)
              ? ((TileEntityStructuralArm) world.getTileEntity(x, y, z)).inverted
              : false;
      ForgeDirection fd = ForgeDirection.getOrientation(f);
      int rowTop = 0;
      while (rowTop < 8) {
        if (world.getTileEntity(x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1))
                instanceof TileEntityStructuralArm
            && ((TileEntityStructuralArm)
                        world.getTileEntity(
                            x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1)))
                    .facing
                == f
            && ((TileEntityStructuralArm)
                        world.getTileEntity(
                            x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1)))
                    .inverted
                == inv) rowTop++;
        else break;
      }
      int rowBot = 0;
      while (rowBot < 8) {
        if (world.getTileEntity(x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1))
                instanceof TileEntityStructuralArm
            && ((TileEntityStructuralArm)
                        world.getTileEntity(
                            x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1)))
                    .facing
                == f
            && ((TileEntityStructuralArm)
                        world.getTileEntity(
                            x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1)))
                    .inverted
                == inv) rowBot++;
        else break;
      }
      double rowTotal = rowTop + rowBot + 1;
      double yTop = 1 - rowTop / rowTotal;
      double yBot = rowBot / rowTotal;

      double d3 = iTop.getInterpolatedU(0);
      double d4 = iTop.getInterpolatedU(16);
      double d5 = iTop.getInterpolatedV(0);
      double d6 = iTop.getInterpolatedV(16);
      double d7 = d4;
      double d8 = d3;
      double d9 = d5;
      double d10 = d6;

      double y11 = f == 5 || f == 3 ? yBot : yTop;
      double y10 = f == 5 || f == 2 ? yBot : yTop;
      double y00 = f == 4 || f == 2 ? yBot : yTop;
      double y01 = f == 4 || f == 3 ? yBot : yTop;

      // SIDE 0
      ClientUtils.BlockLightingInfo info =
          ClientUtils.calculateBlockLighting(0, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 - y01 : 0), z + 1, d8, d10);
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 - y00 : 0), z + 0, d3, d5);
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 - y10 : 0), z + 0, d7, d9);
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 - y11 : 0), z + 1, d4, d6);

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 - y00 : 0) + .0001, z + 0, d3, d5);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 - y01 : 0) + .0001, z + 1, d8, d10);
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 - y11 : 0) + .0001, z + 1, d4, d6);
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 - y10 : 0) + .0001, z + 0, d7, d9);

      // SIDE 1
      info = ClientUtils.calculateBlockLighting(1, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : y11), z + 1, d4, d6);
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : y10), z + 0, d7, d9);
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : y00), z + 0, d3, d5);
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : y01), z + 1, d8, d10);

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : y10) - .0001, z + 0, d7, d9);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : y11) - .0001, z + 1, d4, d6);
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : y01) - .0001, z + 1, d8, d10);
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : y00) - .0001, z + 0, d3, d5);

      // SIDE 2
      info = ClientUtils.calculateBlockLighting(2, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y00 : y00),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y00 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y10 : y10),
          z + 0,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y10 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 0, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y10 : y10),
          z + 0 + .0001,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y10 * 16));
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y00 : y00),
          z + 0 + .0001,
          iSide.getMinU(),
          iSide.getInterpolatedV(y00 * 16));
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 0, y + (inv ? 1 : 0), z + 0 + .0001, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 1, y + (inv ? 1 : 0), z + 0 + .0001, iSide.getMaxU(), iSide.getMinV());

      // SIDE 3
      info = ClientUtils.calculateBlockLighting(3, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y01 : y01),
          z + 1,
          iSide.getMinU(),
          iSide.getInterpolatedV(y01 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 1, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y11 : y11),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y11 * 16));

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 0, y + (inv ? 1 : 0), z + 1 - .0001, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y01 : y01),
          z + 1 - .0001,
          iSide.getMinU(),
          iSide.getInterpolatedV(y01 * 16));
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y11 : y11),
          z + 1 - .0001,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y11 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 1, y + (inv ? 1 : 0), z + 1 - .0001, iSide.getMaxU(), iSide.getMinV());

      // SIDE 4
      info = ClientUtils.calculateBlockLighting(4, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y01 : y01),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y01 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 0,
          y + (inv ? 1 - y00 : y00),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y00 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 0 + .0001,
          y + (inv ? 1 - y00 : y00),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y00 * 16));
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 0 + .0001,
          y + (inv ? 1 - y01 : y01),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y01 * 16));
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 0 + .0001, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 0 + .0001, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());

      // SIDE 5
      info = ClientUtils.calculateBlockLighting(5, world, block, x, y, z, 1, 1, 1);
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y10 : y10),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y10 * 16));
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 1,
          y + (inv ? 1 - y11 : y11),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y11 * 16));

      tes.setColorOpaque_F(
          info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft);
      tes.setBrightness(info.brightnessBottomLeft);
      tes.addVertexWithUV(
          x + 1 - .0001, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft);
      tes.setBrightness(info.brightnessTopLeft);
      tes.addVertexWithUV(
          x + 1 - .0001, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV());
      tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight);
      tes.setBrightness(info.brightnessTopRight);
      tes.addVertexWithUV(
          x + 1 - .0001,
          y + (inv ? 1 - y11 : y11),
          z + 1,
          iSide.getMaxU(),
          iSide.getInterpolatedV(y11 * 16));
      tes.setColorOpaque_F(
          info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight);
      tes.setBrightness(info.brightnessBottomRight);
      tes.addVertexWithUV(
          x + 1 - .0001,
          y + (inv ? 1 - y10 : y10),
          z + 0,
          iSide.getMinU(),
          iSide.getInterpolatedV(y10 * 16));

      return true;
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_connectorStructural) {
      TileEntityConnectorStructural tile =
          (TileEntityConnectorStructural) world.getTileEntity(x, y, z);
      ClientUtils.handleStaticTileRenderer(tile);
      return true;
    } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_wallMount) {
      TileEntityWallmountMetal tile = (TileEntityWallmountMetal) world.getTileEntity(x, y, z);
      ClientUtils.handleStaticTileRenderer(tile);
      return true;
    } else {
      renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
      return renderer.renderStandardBlock(block, x, y, z);
    }
  }
 /**
  * Retrieves an block's icon, with meta support.
  *
  * @param block the block to get the icon for.
  * @param meta the meta value of the block.
  * @return the icon representing the block.
  */
 public static IIcon getIcon(Block block, int meta) {
   return block.getIcon(0, meta);
 }
  @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 Icon getIcon(int side, int meta) {
   return modelBlock.getIcon(2, modelMeta);
 }
  @Override
  public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
    GL11.glPushMatrix();
    try {

      if (metadata == BlockMetalDecoration.META_fence) {
        GL11.glTranslatef(-.5f, -.5f, -.5f);
        renderer.setRenderBounds(0, 0, .375, .25, 1, .625);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
        renderer.setRenderBounds(.75, 0, .375, 1, 1, .625);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
        renderer.setRenderBounds(-.125, .8125, .4375, 1.125, .9375, .5625);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
        renderer.setRenderBounds(-.125, .3125, .4375, 1.125, .4375, .5625);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
        GL11.glTranslatef(.5f, .5f, .5f);
      } else if (metadata == BlockMetalDecoration.META_scaffolding) {
        block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        renderer.setRenderBoundsFromBlock(block);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
      } else if (metadata == BlockMetalDecoration.META_lantern) {
        Tessellator.instance.startDrawingQuads();
        ClientUtils.handleStaticTileRenderer(new TileEntityLantern());
        Tessellator.instance.draw();
      } else if (metadata == BlockMetalDecoration.META_structuralArm) {
        Tessellator tes = ClientUtils.tes();
        IIcon iSide = block.getIcon(2, 3);
        IIcon iTop = block.getIcon(0, 3);

        GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

        tes.startDrawing(6);
        tes.setNormal(0.0F, -1.0F, 0.0F);
        renderer.renderFaceYNeg(block, 0, 0, 0, iTop);
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(0.0F, 1.0F, 0.0F);
        tes.setBrightness(0xff);
        tes.addVertexWithUV(1, 1, 1, iTop.getMaxU(), iTop.getMaxV());
        tes.addVertexWithUV(1, 1, 0, iTop.getMaxU(), iTop.getMinV());
        tes.addVertexWithUV(0, 0, 0, iTop.getMinU(), iTop.getMinV());
        tes.addVertexWithUV(0, 0, 1, iTop.getMinU(), iTop.getMaxV());
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(0.0F, 0.0F, -1.0F);
        tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getInterpolatedV(0 * 16));
        tes.addVertexWithUV(1, 1, 0, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16));
        tes.addVertexWithUV(1, 0, 0, iSide.getMaxU(), iSide.getMinV());
        tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getMinV());
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(0.0F, 0.0F, 1.0F);
        tes.addVertexWithUV(1, 1, 1, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16));
        tes.addVertexWithUV(0, 0, 1, iSide.getMinU(), iSide.getInterpolatedV(0 * 16));
        tes.addVertexWithUV(0, 0, 1, iSide.getMinU(), iSide.getMinV());
        tes.addVertexWithUV(1, 0, 1, iSide.getMaxU(), iSide.getMinV());
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(-1.0F, 0.0F, 0.0F);
        tes.addVertexWithUV(0, 0, 1, iSide.getMaxU(), iSide.getInterpolatedV(0 * 16));
        tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getInterpolatedV(0 * 16));
        tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getMinV());
        tes.addVertexWithUV(0, 0, 1, iSide.getMaxU(), iSide.getMinV());
        tes.draw();

        tes.startDrawing(6);
        tes.setNormal(1.0F, 0.0F, 0.0F);
        tes.addVertexWithUV(1, 1, 0, iSide.getMinU(), iSide.getInterpolatedV(1 * 16));
        tes.addVertexWithUV(1, 1, 1, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16));
        tes.addVertexWithUV(1, 0, 1, iSide.getMaxU(), iSide.getMinV());
        tes.addVertexWithUV(1, 0, 0, iSide.getMinU(), iSide.getMinV());
        tes.draw();
      } else if (metadata == BlockMetalDecoration.META_connectorStructural) {
        Tessellator.instance.startDrawingQuads();
        ClientUtils.handleStaticTileRenderer(new TileEntityConnectorStructural());
        Tessellator.instance.draw();
      } else if (metadata == BlockMetalDecoration.META_wallMount) {
        Tessellator.instance.startDrawingQuads();
        ClientUtils.handleStaticTileRenderer(new TileEntityWallmountMetal());
        Tessellator.instance.draw();
      } else {
        block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
        renderer.setRenderBoundsFromBlock(block);
        ClientUtils.drawInventoryBlock(block, metadata, renderer);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    GL11.glPopMatrix();
  }
  public static void renderInventoryCubes(
      RenderBlocks renderer, ArrayList<CubeObject> cubes, Block parBlock, int meta) {
    Tessellator tesselator = Tessellator.instance;
    for (int i = 0; i < cubes.size(); i++) {
      /* if (block.getRenderBlockPass() != 0)
      {
          GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
          GL11.glEnable(GL11.GL_BLEND);
          OpenGlHelper.glBlendFunc(770, 771, 1, 0);
      }
      else
      {
          GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F);
          GL11.glDisable(GL11.GL_BLEND);
      }*/
      int metadata = 0;
      if (cubes.get(i).meta != -1) metadata = cubes.get(i).meta;
      Block block = parBlock;
      if (block instanceof BlockAir) block = Blocks.stone;
      renderer.setRenderBounds(
          cubes.get(i).minX,
          cubes.get(i).minY,
          cubes.get(i).minZ,
          cubes.get(i).maxX,
          cubes.get(i).maxY,
          cubes.get(i).maxZ);
      if (cubes.get(i).block != null && !(cubes.get(i).block instanceof BlockAir)) {
        block = cubes.get(i).block;
        meta = 0;
      }
      if (cubes.get(i).icon != null) {
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        tesselator.startDrawingQuads();
        tesselator.setNormal(0.0F, -1.0F, 0.0F);
        renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, cubes.get(i).icon);
        tesselator.draw();
        tesselator.startDrawingQuads();
        tesselator.setNormal(0.0F, 1.0F, 0.0F);
        renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, cubes.get(i).icon);
        tesselator.draw();
        tesselator.startDrawingQuads();
        tesselator.setNormal(0.0F, 0.0F, -1.0F);
        renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, cubes.get(i).icon);
        tesselator.draw();
        tesselator.startDrawingQuads();
        tesselator.setNormal(0.0F, 0.0F, 1.0F);
        renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, cubes.get(i).icon);
        tesselator.draw();
        tesselator.startDrawingQuads();
        tesselator.setNormal(-1.0F, 0.0F, 0.0F);
        renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, cubes.get(i).icon);
        tesselator.draw();
        tesselator.startDrawingQuads();
        tesselator.setNormal(1.0F, 0.0F, 0.0F);
        renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, cubes.get(i).icon);
        tesselator.draw();
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
      } else {
        int j = block.getRenderColor(metadata);
        if (cubes.get(i).color != ColorUtils.WHITE) j = cubes.get(i).color;
        /*boolean defaultColor = cubes.get(i).;
        if (defaultColor)
        {
            j = 16777215;
        }*/

        float f1 = (float) (j >> 16 & 255) / 255.0F;
        float f2 = (float) (j >> 8 & 255) / 255.0F;
        float f3 = (float) (j & 255) / 255.0F;
        float brightness = 1.0F;
        GL11.glColor4f(f1 * brightness, f2 * brightness, f3 * brightness, 1.0F);

        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        tesselator.startDrawingQuads();
        tesselator.setNormal(0.0F, -1.0F, 0.0F);
        renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, metadata));
        tesselator.draw();
        tesselator.startDrawingQuads();
        tesselator.setNormal(0.0F, 1.0F, 0.0F);
        renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, metadata));
        tesselator.draw();
        tesselator.startDrawingQuads();
        tesselator.setNormal(0.0F, 0.0F, -1.0F);
        renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, metadata));
        tesselator.draw();
        tesselator.startDrawingQuads();
        tesselator.setNormal(0.0F, 0.0F, 1.0F);
        renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, metadata));
        tesselator.draw();
        tesselator.startDrawingQuads();
        tesselator.setNormal(-1.0F, 0.0F, 0.0F);
        renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, metadata));
        tesselator.draw();
        tesselator.startDrawingQuads();
        tesselator.setNormal(1.0F, 0.0F, 0.0F);
        renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, metadata));
        tesselator.draw();
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
      }
    }
  }
  private void pipeFacadeRenderer(
      RenderBlocks renderblocks, Block block, PipeRenderState state, int x, int y, int z) {

    float zFightOffset = 1F / 4096F;

    float[][] zeroState = new float[3][2];
    // X START - END
    zeroState[0][0] = 0.0F - zFightOffset / 2;
    zeroState[0][1] = 1.0F + zFightOffset / 2;
    // Y START - END
    zeroState[1][0] = 0.0F - zFightOffset;
    zeroState[1][1] = facadeThickness;
    // Z START - END
    zeroState[2][0] = 0.0F;
    zeroState[2][1] = 1.0F;

    for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
      if (state.facadeMatrix.getFacadeBlockId(direction) != 0) {
        Block renderBlock = Block.blocksList[state.facadeMatrix.getFacadeBlockId(direction)];
        int renderMeta = state.facadeMatrix.getFacadeMetaId(direction);
        state.currentTexture = renderBlock.getIcon(direction.ordinal(), renderMeta);

        if (renderBlock.getRenderType() == 31) {
          if ((renderMeta & 12) == 4) {
            renderblocks.uvRotateEast = 1;
            renderblocks.uvRotateWest = 1;
            renderblocks.uvRotateTop = 1;
            renderblocks.uvRotateBottom = 1;
          } else if ((renderMeta & 12) == 8) {
            renderblocks.uvRotateSouth = 1;
            renderblocks.uvRotateNorth = 1;
          }
        }

        // Hollow facade
        if (state.pipeConnectionMatrix.isConnected(direction)) {
          float[][] rotated = deepClone(zeroState);
          rotated[2][0] = 0.0F;
          rotated[2][1] = Utils.pipeMinPos;
          rotated[1][0] -= zFightOffset / 2;
          transform(rotated, direction);
          block.setBlockBounds(
              rotated[0][0],
              rotated[1][0],
              rotated[2][0],
              rotated[0][1],
              rotated[1][1],
              rotated[2][1]);
          renderblocks.setRenderBoundsFromBlock(block);
          renderblocks.renderStandardBlock(block, x, y, z);

          rotated = deepClone(zeroState);
          rotated[2][0] = Utils.pipeMaxPos;
          rotated[1][0] -= zFightOffset / 2;
          transform(rotated, direction);
          block.setBlockBounds(
              rotated[0][0],
              rotated[1][0],
              rotated[2][0],
              rotated[0][1],
              rotated[1][1],
              rotated[2][1]);
          renderblocks.setRenderBoundsFromBlock(block);
          renderblocks.renderStandardBlock(block, x, y, z);

          rotated = deepClone(zeroState);
          rotated[0][0] = 0.0F;
          rotated[0][1] = Utils.pipeMinPos;
          rotated[1][1] -= zFightOffset;
          transform(rotated, direction);
          block.setBlockBounds(
              rotated[0][0],
              rotated[1][0],
              rotated[2][0],
              rotated[0][1],
              rotated[1][1],
              rotated[2][1]);
          renderblocks.setRenderBoundsFromBlock(block);
          renderblocks.renderStandardBlock(block, x, y, z);

          rotated = deepClone(zeroState);
          rotated[0][0] = Utils.pipeMaxPos;
          rotated[0][1] = 1F;
          rotated[1][1] -= zFightOffset;
          transform(rotated, direction);
          block.setBlockBounds(
              rotated[0][0],
              rotated[1][0],
              rotated[2][0],
              rotated[0][1],
              rotated[1][1],
              rotated[2][1]);
          renderblocks.setRenderBoundsFromBlock(block);
          renderblocks.renderStandardBlock(block, x, y, z);
        } else { // Solid facade
          float[][] rotated = deepClone(zeroState);
          transform(rotated, direction);
          block.setBlockBounds(
              rotated[0][0],
              rotated[1][0],
              rotated[2][0],
              rotated[0][1],
              rotated[1][1],
              rotated[2][1]);
          renderblocks.setRenderBoundsFromBlock(block);
          renderblocks.renderStandardBlock(block, x, y, z);
        }

        if (renderBlock.getRenderType() == 31) {
          renderblocks.uvRotateSouth = 0;
          renderblocks.uvRotateEast = 0;
          renderblocks.uvRotateWest = 0;
          renderblocks.uvRotateNorth = 0;
          renderblocks.uvRotateTop = 0;
          renderblocks.uvRotateBottom = 0;
        }
      }
    }

    // X START - END
    zeroState[0][0] = Utils.pipeMinPos;
    zeroState[0][1] = Utils.pipeMaxPos;
    // Y START - END
    zeroState[1][0] = facadeThickness;
    zeroState[1][1] = Utils.pipeMinPos;
    // Z START - END
    zeroState[2][0] = Utils.pipeMinPos;
    zeroState[2][1] = Utils.pipeMaxPos;

    state.currentTexture =
        BuildCraftTransport.instance.pipeIconProvider.getIcon(
            PipeIconProvider.PipeStructureCobblestone); // Structure Pipe

    for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
      if (state.facadeMatrix.getFacadeBlockId(direction) != 0
          && !state.pipeConnectionMatrix.isConnected(direction)) {
        float[][] rotated = deepClone(zeroState);
        transform(rotated, direction);

        block.setBlockBounds(
            rotated[0][0],
            rotated[1][0],
            rotated[2][0],
            rotated[0][1],
            rotated[1][1],
            rotated[2][1]);
        renderblocks.setRenderBoundsFromBlock(block);
        renderblocks.renderStandardBlock(block, x, y, z);
      }
    }
  }