private void drawCrossedSquares(
     IBlockAccess blockAccess,
     double x,
     double y,
     double z,
     float size,
     Block block,
     int meta,
     RenderBlocks renderer) {
   Tessellator tessellator = Tessellator.instance;
   IIcon icon = renderer.getBlockIcon(block, blockAccess, (int) x, (int) y, (int) z, meta);
   if (renderer.hasOverrideBlockTexture()) {
     icon = renderer.overrideBlockTexture;
   }
   double minU = (double) icon.getMinU();
   double minV = (double) icon.getMinV();
   double maxU = (double) icon.getMaxU();
   double maxV = (double) icon.getMaxV();
   double scaledSize = 0.45D * (double) size;
   double minX = x + 0.5D - scaledSize;
   double maxX = x + 0.5D + scaledSize;
   double minZ = z + 0.5D - scaledSize;
   double maxZ = z + 0.5D + scaledSize;
   tessellator.addVertexWithUV(minX, y + (double) size, minZ, minU, minV);
   tessellator.addVertexWithUV(minX, y + 0.0D, minZ, minU, maxV);
   tessellator.addVertexWithUV(maxX, y + 0.0D, maxZ, maxU, maxV);
   tessellator.addVertexWithUV(maxX, y + (double) size, maxZ, maxU, minV);
   tessellator.addVertexWithUV(maxX, y + (double) size, maxZ, minU, minV);
   tessellator.addVertexWithUV(maxX, y + 0.0D, maxZ, minU, maxV);
   tessellator.addVertexWithUV(minX, y + 0.0D, minZ, maxU, maxV);
   tessellator.addVertexWithUV(minX, y + (double) size, minZ, maxU, minV);
   tessellator.addVertexWithUV(minX, y + (double) size, maxZ, minU, minV);
   tessellator.addVertexWithUV(minX, y + 0.0D, maxZ, minU, maxV);
   tessellator.addVertexWithUV(maxX, y + 0.0D, minZ, maxU, maxV);
   tessellator.addVertexWithUV(maxX, y + (double) size, minZ, maxU, minV);
   tessellator.addVertexWithUV(maxX, y + (double) size, minZ, minU, minV);
   tessellator.addVertexWithUV(maxX, y + 0.0D, minZ, minU, maxV);
   tessellator.addVertexWithUV(minX, y + 0.0D, maxZ, maxU, maxV);
   tessellator.addVertexWithUV(minX, y + (double) size, maxZ, maxU, minV);
 }
示例#2
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks renderer) {
    BlockPane block = (BlockPane) b;
    Tessellator tessellator = Tessellator.instance;

    tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));

    float f = 1.0F;
    int i1 = block.colorMultiplier(world, x, y, z);
    float f1 = (i1 >> 16 & 255) / 255.0F;
    float f2 = (i1 >> 8 & 255) / 255.0F;
    float f3 = (i1 & 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);

    int meta = world.getBlockMetadata(x, y, z);
    IIcon iconPane = block.getIcon(2, meta);
    IIcon iconTop = block.getIcon(1, meta);
    IIcon iconSide = block.getIcon(0, meta);
    if (iconPane == null || iconTop == null || iconSide == null) return false;

    if (renderer.hasOverrideBlockTexture()) {
      paneRenderer.set(
          x,
          y,
          z,
          renderer.overrideBlockTexture,
          renderer.overrideBlockTexture,
          renderer.overrideBlockTexture);
    } else {
      paneRenderer.set(x, y, z, iconPane, iconTop, iconSide);
    }

    boolean connectsNorth = block.canPaneConnectToBlock(world.getBlock(x, y, z - 1));
    boolean connectsSouth = block.canPaneConnectToBlock(world.getBlock(x, y, z + 1));
    boolean connectsWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y, z));
    boolean connectsEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y, z));
    boolean connectsTop = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z));
    boolean connectsBottom = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z));

    boolean connectsTopNorth = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z - 1));
    boolean connectsTopSouth = block.canPaneConnectToBlock(world.getBlock(x, y + 1, z + 1));
    boolean connectsTopWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y + 1, z));
    boolean connectsTopEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y + 1, z));

    boolean connectsBottomNorth = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z - 1));
    boolean connectsBottomSouth = block.canPaneConnectToBlock(world.getBlock(x, y - 1, z + 1));
    boolean connectsBottomWest = block.canPaneConnectToBlock(world.getBlock(x - 1, y - 1, z));
    boolean connectsBottomEast = block.canPaneConnectToBlock(world.getBlock(x + 1, y - 1, z));

    boolean isolatedTop =
        !connectsTopNorth && !connectsTopSouth && !connectsTopWest && !connectsTopEast;
    boolean isolatedBottom =
        !connectsBottomNorth && !connectsBottomSouth && !connectsBottomWest && !connectsBottomEast;

    if (!connectsNorth && !connectsSouth && !connectsWest && !connectsEast) {
      connectsNorth = connectsSouth = connectsWest = connectsEast = true;
    }

    int connections = 0;
    if (connectsNorth) {
      paneRenderer.renderNorthPane();
      if (!connectsBottom || !connectsBottomNorth && !isolatedBottom)
        paneRenderer.renderVerticalNS(-0.0003, 0.0, 0.5, 0.5, 0.0);
      if (!connectsTop || !connectsTopNorth && !isolatedTop)
        paneRenderer.renderVerticalNS(+1.0003, 0.0, 0.5, 0.5, 0.0);
      connections++;
    }
    if (connectsSouth) {
      paneRenderer.renderSouthPane();
      if (!connectsBottom || !connectsBottomSouth && !isolatedBottom)
        paneRenderer.renderVerticalNS(-0.0004, 0.5, 1.0, 1.0, 0.5);
      if (!connectsTop || !connectsTopSouth && !isolatedTop)
        paneRenderer.renderVerticalNS(+1.0004, 0.5, 1.0, 1.0, 0.5);
      connections++;
    }
    if (connectsWest) {
      paneRenderer.renderWestPane();
      if (!connectsBottom || !connectsBottomWest && !isolatedBottom)
        paneRenderer.renderVerticalWE(-0.0001, 0.0, 0.5, 0.5, 0.0);
      if (!connectsTop || !connectsTopWest && !isolatedTop)
        paneRenderer.renderVerticalWE(+1.0001, 0.0, 0.5, 0.5, 0.0);
      connections++;
    }
    if (connectsEast) {
      paneRenderer.renderEastPane();
      if (!connectsBottom || !connectsBottomEast && !isolatedBottom)
        paneRenderer.renderVerticalWE(-0.0002, 0.5, 1.0, 1.0, 0.5);
      if (!connectsTop || !connectsTopEast && !isolatedTop)
        paneRenderer.renderVerticalWE(+1.0002, 0.5, 1.0, 1.0, 0.5);
      connections++;
    }

    if (connections == 1) {
      if (connectsNorth) paneRenderer.renderHorizontalNS(0.5, 1.0, 0.0);
      if (connectsSouth) paneRenderer.renderHorizontalNS(0.5, 0.0, 1.0);
      if (connectsEast) paneRenderer.renderHorizontalWE(0.5, 0.0, 1.0);
      if (connectsWest) paneRenderer.renderHorizontalWE(0.5, 1.0, 0.0);
    } else if (connections == 4) {
      paneRenderer.renderHorizontalNS(0.0, 1.0, 0.0);
      paneRenderer.renderHorizontalNS(1.0, 0.0, 1.0);
      paneRenderer.renderHorizontalWE(0.0, 0.0, 1.0);
      paneRenderer.renderHorizontalWE(1.0, 1.0, 0.0);
    }

    return true;
  }
  @Override
  public boolean renderWorldBlock(
      IBlockAccess blockAccess,
      int i,
      int j,
      int k,
      Block bblock,
      int modelId,
      RenderBlocks renderer) {
    BlockLantern block = (BlockLantern) bblock;

    Icon icon =
        renderer.hasOverrideBlockTexture()
            ? renderer.overrideBlockTexture
            : renderer.getBlockIcon(block);
    int brightness = block.getMixedBrightnessForBlock(blockAccess, i, j, k);
    Tessellator tessellator = Tessellator.instance;

    double minX = 4.0 / 16.0D;
    double minY = 0.0 / 16.0D;
    double minZ = 4.0 / 16.0D;
    double maxX = 12.0 / 16.0D;
    double maxY = 10.0 / 16.0D;
    double maxZ = 12.0 / 16.0D;

    double uvMinU = icon.getInterpolatedU(0.0D);
    double uvMaxU = icon.getInterpolatedU(8.0D);
    double uvMinV = icon.getInterpolatedV(6.0D);
    double uvMaxV = icon.getInterpolatedV(16.0D);

    tessellator.setBrightness(brightness);

    tessellator.addTranslation((float) i, (float) j, (float) k);

    {
      tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
      tessellator.addVertexWithUV(minX, minY, minZ, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(minX, maxY, minZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(maxX, maxY, minZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(maxX, minY, minZ, uvMinU, uvMaxV);

      tessellator.addVertexWithUV(maxX, minY, minZ, uvMinU, uvMaxV);
      tessellator.addVertexWithUV(maxX, maxY, minZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(minX, maxY, minZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(minX, minY, minZ, uvMaxU, uvMaxV);
    }

    {
      tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
      tessellator.addVertexWithUV(maxX, minY, maxZ, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(maxX, maxY, maxZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(minX, maxY, maxZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(minX, minY, maxZ, uvMinU, uvMaxV);

      tessellator.addVertexWithUV(minX, minY, maxZ, uvMinU, uvMaxV);
      tessellator.addVertexWithUV(minX, maxY, maxZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(maxX, maxY, maxZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(maxX, minY, maxZ, uvMaxU, uvMaxV);
    }

    {
      tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
      tessellator.addVertexWithUV(minX, minY, minZ, uvMinU, uvMaxV);
      tessellator.addVertexWithUV(minX, maxY, minZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(minX, maxY, maxZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(minX, minY, maxZ, uvMaxU, uvMaxV);

      tessellator.addVertexWithUV(minX, minY, maxZ, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(minX, maxY, maxZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(minX, maxY, minZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(minX, minY, minZ, uvMinU, uvMaxV);
    }

    {
      tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
      tessellator.addVertexWithUV(maxX, minY, maxZ, uvMinU, uvMaxV);
      tessellator.addVertexWithUV(maxX, maxY, maxZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(maxX, maxY, minZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(maxX, minY, minZ, uvMaxU, uvMaxV);

      tessellator.addVertexWithUV(maxX, minY, minZ, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(maxX, maxY, minZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(maxX, maxY, maxZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(maxX, minY, maxZ, uvMinU, uvMaxV);
    }

    uvMinU = icon.getInterpolatedU(8.0D);
    uvMaxU = icon.getInterpolatedU(16.0D);
    uvMinV = icon.getInterpolatedV(8.0D);
    uvMaxV = icon.getInterpolatedV(16.0D);

    {
      tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F);
      tessellator.addVertexWithUV(maxX, minY, minZ, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(maxX, minY, maxZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(minX, minY, maxZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(minX, minY, minZ, uvMinU, uvMaxV);

      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(maxX, maxY, maxZ, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(maxX, maxY, minZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(minX, maxY, minZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(minX, maxY, maxZ, uvMinU, uvMaxV);

      tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F);
      tessellator.addVertexWithUV(minX, maxY, maxZ, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(minX, maxY, minZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(maxX, maxY, minZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(maxX, maxY, maxZ, uvMinU, uvMaxV);
    }

    minY = 2.0D / 16.0D;

    {
      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(minX, minY, minZ, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(minX, minY, maxZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(maxX, minY, maxZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(maxX, minY, minZ, uvMinU, uvMaxV);
    }

    double indent = 3.0D / 16.0D;

    uvMinU = icon.getInterpolatedU(8.0D);
    uvMaxU = icon.getInterpolatedU(16.0D);
    uvMinV = icon.getInterpolatedV(1.0D);
    uvMaxV = icon.getInterpolatedV(8.0D);

    minX = 4.0D / 16.0D;
    maxX = 12.0D / 16.0D;
    minY = 2.0D / 16.0D;
    maxY = 9.0D / 16.0D;
    minZ = 4.0D / 16.0D;
    maxZ = 12.0D / 16.0D;

    {
      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(minX, minY, minZ + indent, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(minX, maxY, minZ + indent, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(maxX, maxY, minZ + indent, uvMinU, uvMinV);
      tessellator.addVertexWithUV(maxX, minY, minZ + indent, uvMinU, uvMaxV);

      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(maxX, minY, minZ + indent, uvMinU, uvMaxV);
      tessellator.addVertexWithUV(maxX, maxY, minZ + indent, uvMinU, uvMinV);
      tessellator.addVertexWithUV(minX, maxY, minZ + indent, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(minX, minY, minZ + indent, uvMaxU, uvMaxV);
    }

    {
      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(maxX, minY, maxZ - indent, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(maxX, maxY, maxZ - indent, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(minX, maxY, maxZ - indent, uvMinU, uvMinV);
      tessellator.addVertexWithUV(minX, minY, maxZ - indent, uvMinU, uvMaxV);

      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(minX, minY, maxZ - indent, uvMinU, uvMaxV);
      tessellator.addVertexWithUV(minX, maxY, maxZ - indent, uvMinU, uvMinV);
      tessellator.addVertexWithUV(maxX, maxY, maxZ - indent, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(maxX, minY, maxZ - indent, uvMaxU, uvMaxV);
    }

    {
      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(minX + indent, minY, minZ, uvMinU, uvMaxV);
      tessellator.addVertexWithUV(minX + indent, maxY, minZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(minX + indent, maxY, maxZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(minX + indent, minY, maxZ, uvMaxU, uvMaxV);

      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(minX + indent, minY, maxZ, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(minX + indent, maxY, maxZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(minX + indent, maxY, minZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(minX + indent, minY, minZ, uvMinU, uvMaxV);
    }

    {
      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(maxX - indent, minY, maxZ, uvMinU, uvMaxV);
      tessellator.addVertexWithUV(maxX - indent, maxY, maxZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(maxX - indent, maxY, minZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(maxX - indent, minY, minZ, uvMaxU, uvMaxV);

      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(maxX - indent, minY, minZ, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(maxX - indent, maxY, minZ, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(maxX - indent, maxY, maxZ, uvMinU, uvMinV);
      tessellator.addVertexWithUV(maxX - indent, minY, maxZ, uvMinU, uvMaxV);
    }

    uvMinU = icon.getInterpolatedU(0.0D);
    uvMaxU = icon.getInterpolatedU(8.0D);
    uvMinV = icon.getInterpolatedV(1.0D);
    uvMaxV = icon.getInterpolatedV(6.0D);

    float handleRot = 0.0F;
    boolean renderDoubleHandle = false;

    boolean s1 = false;
    boolean s2 = false;
    boolean s3 = false;
    boolean s4 = false;

    if (blockAccess.isBlockOpaqueCube(i, j + 1, k)) {
      renderDoubleHandle = true;
      handleRot = 45.0F;
    } else if (!blockAccess.isBlockOpaqueCube(i, j - 1, k)) {
      s1 = blockAccess.isBlockOpaqueCube(i - 1, j, k);
      s2 = blockAccess.isBlockOpaqueCube(i, j, k - 1);
      s3 = blockAccess.isBlockOpaqueCube(i + 1, j, k);
      s4 = blockAccess.isBlockOpaqueCube(i, j, k + 1);

      if (s1 & s2 & s3 & s4) {
        handleRot = 45.0F;
      } else if ((s1 & s2) | (s3 & s4)) {
        handleRot = 45.0F;
      } else if ((s2 & s3) | (s4 & s1)) {
        handleRot = -45.0F;
      } else if (!s2 & !s4) {
        handleRot = 0.0F;
      } else if (!s1 & !s3) {
        handleRot = 90.0F;
      }
    }

    {
      double x1 = 0.5D - Math.sin(handleRot * Math.PI / 180.0D) * 0.25D;
      double x2 = 1.0D - x1;
      double z1 = 0.5D - Math.cos(handleRot * Math.PI / 180.0D) * 0.25D;
      double z2 = 1.0D - z1;
      double y1 = 10.0D / 16.0D;
      double y2 = 15.0D / 16.0D;

      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(x1, y1, z1, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(x1, y2, z1, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(x2, y2, z2, uvMinU, uvMinV);
      tessellator.addVertexWithUV(x2, y1, z2, uvMinU, uvMaxV);

      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(x2, y1, z2, uvMinU, uvMaxV);
      tessellator.addVertexWithUV(x2, y2, z2, uvMinU, uvMinV);
      tessellator.addVertexWithUV(x1, y2, z1, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(x1, y1, z1, uvMaxU, uvMaxV);
    }

    if (renderDoubleHandle) {
      double x1 = 0.5D - Math.sin((handleRot + 90) * Math.PI / 180.0D) * 0.25D;
      double x2 = 1.0D - x1;
      double z1 = 0.5D - Math.cos((handleRot + 90) * Math.PI / 180.0D) * 0.25D;
      double z2 = 1.0D - z1;
      double y1 = 18.0D / 16.0D;
      double y2 = 13.0D / 16.0D;

      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(x1, y1, z1, uvMaxU, uvMaxV);
      tessellator.addVertexWithUV(x1, y2, z1, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(x2, y2, z2, uvMinU, uvMinV);
      tessellator.addVertexWithUV(x2, y1, z2, uvMinU, uvMaxV);

      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      tessellator.addVertexWithUV(x2, y1, z2, uvMinU, uvMaxV);
      tessellator.addVertexWithUV(x2, y2, z2, uvMinU, uvMinV);
      tessellator.addVertexWithUV(x1, y2, z1, uvMaxU, uvMinV);
      tessellator.addVertexWithUV(x1, y1, z1, uvMaxU, uvMaxV);
    } else {
      uvMinV = icon.getInterpolatedV(0.0D);
      uvMaxV = icon.getInterpolatedV(1.0D);
      minY = 13.0D / 16.0D;
      maxY = 14.0D / 16.0D;

      if (s1 | s3) {
        uvMinU = icon.getInterpolatedU(0.0D);
        uvMaxU = icon.getInterpolatedU(16.0D);

        minZ = 7.5D / 16.0D;
        maxZ = 1.0D - minZ;

        if (s1) {
          uvMinU = icon.getInterpolatedU(0.0D);
          minX = 0.0D;
        } else {
          uvMinU = icon.getInterpolatedU(7.0D);
          minX = 6.0D / 16.0D;

          double uv2MinU = icon.getInterpolatedU(0.0D);
          double uv2MaxU = icon.getInterpolatedU(1.0D);
          double uv2MinV = icon.getInterpolatedV(0.0D);
          double uv2MaxV = icon.getInterpolatedV(1.0D);

          tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
          tessellator.addVertexWithUV(minX, minY, maxZ, uv2MinU, uv2MaxV);
          tessellator.addVertexWithUV(minX, maxY, maxZ, uv2MinU, uv2MinV);
          tessellator.addVertexWithUV(minX, maxY, minZ, uv2MaxU, uv2MinV);
          tessellator.addVertexWithUV(minX, minY, minZ, uv2MaxU, uv2MaxV);
        }

        if (s3) {
          uvMaxU = icon.getInterpolatedU(16.0D);
          maxX = 1.0D;
        } else {
          uvMaxU = icon.getInterpolatedU(9.0D);
          maxX = 10.0D / 16.0D;

          double uv2MinU = icon.getInterpolatedU(0.0D);
          double uv2MaxU = icon.getInterpolatedU(1.0D);
          double uv2MinV = icon.getInterpolatedV(0.0D);
          double uv2MaxV = icon.getInterpolatedV(1.0D);

          tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
          tessellator.addVertexWithUV(maxX, minY, minZ, uv2MinU, uv2MaxV);
          tessellator.addVertexWithUV(maxX, maxY, minZ, uv2MinU, uv2MinV);
          tessellator.addVertexWithUV(maxX, maxY, maxZ, uv2MaxU, uv2MinV);
          tessellator.addVertexWithUV(maxX, minY, maxZ, uv2MaxU, uv2MaxV);
        }

        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
        tessellator.addVertexWithUV(maxX, maxY, maxZ, uvMinU, uvMaxV);
        tessellator.addVertexWithUV(maxX, maxY, minZ, uvMinU, uvMinV);
        tessellator.addVertexWithUV(minX, maxY, minZ, uvMaxU, uvMinV);
        tessellator.addVertexWithUV(minX, maxY, maxZ, uvMaxU, uvMaxV);

        tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
        tessellator.addVertexWithUV(minX, minY, minZ, uvMaxU, uvMaxV);
        tessellator.addVertexWithUV(minX, maxY, minZ, uvMaxU, uvMinV);
        tessellator.addVertexWithUV(maxX, maxY, minZ, uvMinU, uvMinV);
        tessellator.addVertexWithUV(maxX, minY, minZ, uvMinU, uvMaxV);

        tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F);
        tessellator.addVertexWithUV(maxX, minY, minZ, uvMaxU, uvMaxV);
        tessellator.addVertexWithUV(maxX, minY, maxZ, uvMaxU, uvMinV);
        tessellator.addVertexWithUV(minX, minY, maxZ, uvMinU, uvMinV);
        tessellator.addVertexWithUV(minX, minY, minZ, uvMinU, uvMaxV);

        tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
        tessellator.addVertexWithUV(maxX, minY, maxZ, uvMinU, uvMaxV);
        tessellator.addVertexWithUV(maxX, maxY, maxZ, uvMinU, uvMinV);
        tessellator.addVertexWithUV(minX, maxY, maxZ, uvMaxU, uvMinV);
        tessellator.addVertexWithUV(minX, minY, maxZ, uvMaxU, uvMaxV);
      }

      if (s2 | s4) {
        uvMinU = icon.getInterpolatedU(0.0D);
        uvMaxU = icon.getInterpolatedU(16.0D);

        minX = 7.5D / 16.0D;
        maxX = 1.0D - minX;

        if (s2) {
          uvMinU = icon.getInterpolatedU(0.0D);
          minZ = 0.0D;
        } else {
          uvMinU = icon.getInterpolatedU(7.0D);
          minZ = 6.0D / 16.0D;

          double uv2MinU = icon.getInterpolatedU(0.0D);
          double uv2MaxU = icon.getInterpolatedU(1.0D);
          double uv2MinV = icon.getInterpolatedV(0.0D);
          double uv2MaxV = icon.getInterpolatedV(1.0D);

          tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
          tessellator.addVertexWithUV(minX, minY, minZ, uv2MaxU, uv2MaxV);
          tessellator.addVertexWithUV(minX, maxY, minZ, uv2MaxU, uv2MinV);
          tessellator.addVertexWithUV(maxX, maxY, minZ, uv2MinU, uv2MinV);
          tessellator.addVertexWithUV(maxX, minY, minZ, uv2MinU, uv2MaxV);
        }

        if (s4) {
          uvMaxU = icon.getInterpolatedU(16.0D);
          maxZ = 1.0D;
        } else {
          uvMaxU = icon.getInterpolatedU(9.0D);
          maxZ = 10.0D / 16.0D;

          double uv2MinU = icon.getInterpolatedU(0.0D);
          double uv2MaxU = icon.getInterpolatedU(1.0D);
          double uv2MinV = icon.getInterpolatedV(0.0D);
          double uv2MaxV = icon.getInterpolatedV(1.0D);

          tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
          tessellator.addVertexWithUV(maxX, minY, maxZ, uv2MaxU, uv2MaxV);
          tessellator.addVertexWithUV(maxX, maxY, maxZ, uv2MaxU, uv2MinV);
          tessellator.addVertexWithUV(minX, maxY, maxZ, uv2MinU, uv2MinV);
          tessellator.addVertexWithUV(minX, minY, maxZ, uv2MinU, uv2MaxV);
        }

        tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
        tessellator.addVertexWithUV(maxX, maxY, maxZ, uvMinU, uvMaxV);
        tessellator.addVertexWithUV(maxX, maxY, minZ, uvMaxU, uvMaxV);
        tessellator.addVertexWithUV(minX, maxY, minZ, uvMaxU, uvMinV);
        tessellator.addVertexWithUV(minX, maxY, maxZ, uvMinU, uvMinV);

        tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
        tessellator.addVertexWithUV(minX, minY, maxZ, uvMinU, uvMaxV);
        tessellator.addVertexWithUV(minX, maxY, maxZ, uvMinU, uvMinV);
        tessellator.addVertexWithUV(minX, maxY, minZ, uvMaxU, uvMinV);
        tessellator.addVertexWithUV(minX, minY, minZ, uvMaxU, uvMaxV);

        tessellator.setColorOpaque_F(0.6F, 0.6F, 0.6F);
        tessellator.addVertexWithUV(maxX, minY, minZ, uvMinU, uvMaxV);
        tessellator.addVertexWithUV(maxX, minY, maxZ, uvMaxU, uvMaxV);
        tessellator.addVertexWithUV(minX, minY, maxZ, uvMaxU, uvMinV);
        tessellator.addVertexWithUV(minX, minY, minZ, uvMinU, uvMinV);

        tessellator.setColorOpaque_F(0.8F, 0.8F, 0.8F);
        tessellator.addVertexWithUV(maxX, minY, minZ, uvMinU, uvMaxV);
        tessellator.addVertexWithUV(maxX, maxY, minZ, uvMinU, uvMinV);
        tessellator.addVertexWithUV(maxX, maxY, maxZ, uvMaxU, uvMinV);
        tessellator.addVertexWithUV(maxX, minY, maxZ, uvMaxU, uvMaxV);
      }
    }

    tessellator.addTranslation((float) -i, (float) -j, (float) -k);

    return true;
  }
  private boolean renderBlockWoodLadder(
      IBlockAccess blockAccess,
      int x,
      int y,
      int z,
      BlockWoodLadder block,
      int modelID,
      RenderBlocks renderer) {
    int color = block.colorMultiplier(blockAccess, 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;
    if (EntityRenderer.anaglyphEnable) {
      float f3 = (r * 30.0F + g * 59.0F + b * 11.0F) / 100.0F;
      float f4 = (r * 30.0F + g * 70.0F) / 100.0F;
      float f5 = (r * 30.0F + b * 70.0F) / 100.0F;
      r = f3;
      g = f4;
      b = f5;
    }
    TileEntityMetadata tile = (TileEntityMetadata) blockAccess.getTileEntity(x, y, z);
    int meta = tile.getTileMetadata();
    int direction = meta & 7;

    Tessellator tessellator = Tessellator.instance;
    IIcon icon = renderer.getBlockIconFromSideAndMetadata(block, 0, meta);
    if (renderer.hasOverrideBlockTexture()) {
      icon = renderer.overrideBlockTexture;
    }
    tessellator.setBrightness(block.getMixedBrightnessForBlock(blockAccess, x, y, z));
    tessellator.setColorOpaque_F(r, g, b);
    double minU = (double) icon.getMinU();
    double minV = (double) icon.getMinV();
    double maxU = (double) icon.getMaxU();
    double maxV = (double) icon.getMaxV();
    double d4 = 0.0D;
    double d5 = 0.05000000074505806D;

    if (direction == 5) {
      tessellator.addVertexWithUV(
          (double) x + d5, (double) (y + 1) + d4, (double) (z + 1) + d4, minU, minV);
      tessellator.addVertexWithUV(
          (double) x + d5, (double) (y + 0) - d4, (double) (z + 1) + d4, minU, maxV);
      tessellator.addVertexWithUV(
          (double) x + d5, (double) (y + 0) - d4, (double) (z + 0) - d4, maxU, maxV);
      tessellator.addVertexWithUV(
          (double) x + d5, (double) (y + 1) + d4, (double) (z + 0) - d4, maxU, minV);
    }
    if (direction == 4) {
      tessellator.addVertexWithUV(
          (double) (x + 1) - d5, (double) (y + 0) - d4, (double) (z + 1) + d4, maxU, maxV);
      tessellator.addVertexWithUV(
          (double) (x + 1) - d5, (double) (y + 1) + d4, (double) (z + 1) + d4, maxU, minV);
      tessellator.addVertexWithUV(
          (double) (x + 1) - d5, (double) (y + 1) + d4, (double) (z + 0) - d4, minU, minV);
      tessellator.addVertexWithUV(
          (double) (x + 1) - d5, (double) (y + 0) - d4, (double) (z + 0) - d4, minU, maxV);
    }
    if (direction == 3) {
      tessellator.addVertexWithUV(
          (double) (x + 1) + d4, (double) (y + 0) - d4, (double) z + d5, maxU, maxV);
      tessellator.addVertexWithUV(
          (double) (x + 1) + d4, (double) (y + 1) + d4, (double) z + d5, maxU, minV);
      tessellator.addVertexWithUV(
          (double) (x + 0) - d4, (double) (y + 1) + d4, (double) z + d5, minU, minV);
      tessellator.addVertexWithUV(
          (double) (x + 0) - d4, (double) (y + 0) - d4, (double) z + d5, minU, maxV);
    }
    if (direction == 2) {
      tessellator.addVertexWithUV(
          (double) (x + 1) + d4, (double) (y + 1) + d4, (double) (z + 1) - d5, minU, minV);
      tessellator.addVertexWithUV(
          (double) (x + 1) + d4, (double) (y + 0) - d4, (double) (z + 1) - d5, minU, maxV);
      tessellator.addVertexWithUV(
          (double) (x + 0) - d4, (double) (y + 0) - d4, (double) (z + 1) - d5, maxU, maxV);
      tessellator.addVertexWithUV(
          (double) (x + 0) - d4, (double) (y + 1) + d4, (double) (z + 1) - d5, maxU, minV);
    }
    return true;
  }
示例#5
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world,
      int par2,
      int par3,
      int par4,
      Block par1Block,
      int modelId,
      RenderBlocks renderer) {
    if (modelId == model) {
      int l = renderer.blockAccess.getBlockMetadata(par2, par3, par4);
      int i1 = l & 7;
      boolean flag = (l & 8) > 0;
      Tessellator tessellator = Tessellator.instance;
      boolean flag1 = renderer.hasOverrideBlockTexture();

      if (!flag1) {
        renderer.setOverrideBlockTexture(renderer.getBlockIcon(Block.netherrack));
      }

      float f = 0.25F;
      float f1 = 0.1875F;
      float f2 = 0.1875F;

      if (i1 == 5) {
        renderer.setRenderBounds(
            (double) (0.5F - f1),
            0.0D,
            (double) (0.5F - f),
            (double) (0.5F + f1),
            (double) f2,
            (double) (0.5F + f));
      } else if (i1 == 6) {
        renderer.setRenderBounds(
            (double) (0.5F - f),
            0.0D,
            (double) (0.5F - f1),
            (double) (0.5F + f),
            (double) f2,
            (double) (0.5F + f1));
      } else if (i1 == 4) {
        renderer.setRenderBounds(
            (double) (0.5F - f1),
            (double) (0.5F - f),
            (double) (1.0F - f2),
            (double) (0.5F + f1),
            (double) (0.5F + f),
            1.0D);
      } else if (i1 == 3) {
        renderer.setRenderBounds(
            (double) (0.5F - f1),
            (double) (0.5F - f),
            0.0D,
            (double) (0.5F + f1),
            (double) (0.5F + f),
            (double) f2);
      } else if (i1 == 2) {
        renderer.setRenderBounds(
            (double) (1.0F - f2),
            (double) (0.5F - f),
            (double) (0.5F - f1),
            1.0D,
            (double) (0.5F + f),
            (double) (0.5F + f1));
      } else if (i1 == 1) {
        renderer.setRenderBounds(
            0.0D,
            (double) (0.5F - f),
            (double) (0.5F - f1),
            (double) f2,
            (double) (0.5F + f),
            (double) (0.5F + f1));
      } else if (i1 == 0) {
        renderer.setRenderBounds(
            (double) (0.5F - f),
            (double) (1.0F - f2),
            (double) (0.5F - f1),
            (double) (0.5F + f),
            1.0D,
            (double) (0.5F + f1));
      } else if (i1 == 7) {
        renderer.setRenderBounds(
            (double) (0.5F - f1),
            (double) (1.0F - f2),
            (double) (0.5F - f),
            (double) (0.5F + f1),
            1.0D,
            (double) (0.5F + f));
      }

      renderer.renderStandardBlock(par1Block, par2, par3, par4);

      if (!flag1) {
        renderer.clearOverrideBlockTexture();
      }

      tessellator.setBrightness(
          par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4));
      float f3 = 1.0F;

      if (Block.lightValue[par1Block.blockID] > 0) {
        f3 = 1.0F;
      }

      tessellator.setColorOpaque_F(f3, f3, f3);
      Icon icon = renderer.getBlockIconFromSide(par1Block, 0);

      if (renderer.hasOverrideBlockTexture()) {
        icon = renderer.overrideBlockTexture;
      }

      double d0 = (double) icon.getMinU();
      double d1 = (double) icon.getMinV();
      double d2 = (double) icon.getMaxU();
      double d3 = (double) icon.getMaxV();
      Vec3[] avec3 = new Vec3[8];
      float f4 = 0.0625F;
      float f5 = 0.0625F;
      float f6 = 0.625F;
      avec3[0] =
          renderer
              .blockAccess
              .getWorldVec3Pool()
              .getVecFromPool((double) (-f4), 0.0D, (double) (-f5));
      avec3[1] =
          renderer.blockAccess.getWorldVec3Pool().getVecFromPool((double) f4, 0.0D, (double) (-f5));
      avec3[2] =
          renderer.blockAccess.getWorldVec3Pool().getVecFromPool((double) f4, 0.0D, (double) f5);
      avec3[3] =
          renderer.blockAccess.getWorldVec3Pool().getVecFromPool((double) (-f4), 0.0D, (double) f5);
      avec3[4] =
          renderer
              .blockAccess
              .getWorldVec3Pool()
              .getVecFromPool((double) (-f4), (double) f6, (double) (-f5));
      avec3[5] =
          renderer
              .blockAccess
              .getWorldVec3Pool()
              .getVecFromPool((double) f4, (double) f6, (double) (-f5));
      avec3[6] =
          renderer
              .blockAccess
              .getWorldVec3Pool()
              .getVecFromPool((double) f4, (double) f6, (double) f5);
      avec3[7] =
          renderer
              .blockAccess
              .getWorldVec3Pool()
              .getVecFromPool((double) (-f4), (double) f6, (double) f5);

      for (int j1 = 0; j1 < 8; ++j1) {
        if (flag) {
          avec3[j1].zCoord -= 0.0625D;
          avec3[j1].rotateAroundX(((float) Math.PI * 2F / 9F));
        } else {
          avec3[j1].zCoord += 0.0625D;
          avec3[j1].rotateAroundX(-((float) Math.PI * 2F / 9F));
        }

        if (i1 == 0 || i1 == 7) {
          avec3[j1].rotateAroundZ((float) Math.PI);
        }

        if (i1 == 6 || i1 == 0) {
          avec3[j1].rotateAroundY(((float) Math.PI / 2F));
        }

        if (i1 > 0 && i1 < 5) {
          avec3[j1].yCoord -= 0.375D;
          avec3[j1].rotateAroundX(((float) Math.PI / 2F));

          if (i1 == 4) {
            avec3[j1].rotateAroundY(0.0F);
          }

          if (i1 == 3) {
            avec3[j1].rotateAroundY((float) Math.PI);
          }

          if (i1 == 2) {
            avec3[j1].rotateAroundY(((float) Math.PI / 2F));
          }

          if (i1 == 1) {
            avec3[j1].rotateAroundY(-((float) Math.PI / 2F));
          }

          avec3[j1].xCoord += (double) par2 + 0.5D;
          avec3[j1].yCoord += (double) ((float) par3 + 0.5F);
          avec3[j1].zCoord += (double) par4 + 0.5D;
        } else if (i1 != 0 && i1 != 7) {
          avec3[j1].xCoord += (double) par2 + 0.5D;
          avec3[j1].yCoord += (double) ((float) par3 + 0.125F);
          avec3[j1].zCoord += (double) par4 + 0.5D;
        } else {
          avec3[j1].xCoord += (double) par2 + 0.5D;
          avec3[j1].yCoord += (double) ((float) par3 + 0.875F);
          avec3[j1].zCoord += (double) par4 + 0.5D;
        }
      }

      Vec3 vec3 = null;
      Vec3 vec31 = null;
      Vec3 vec32 = null;
      Vec3 vec33 = null;

      for (int k1 = 0; k1 < 6; ++k1) {
        if (k1 == 0) {
          d0 = (double) icon.getInterpolatedU(7.0D);
          d1 = (double) icon.getInterpolatedV(6.0D);
          d2 = (double) icon.getInterpolatedU(9.0D);
          d3 = (double) icon.getInterpolatedV(8.0D);
        } else if (k1 == 2) {
          d0 = (double) icon.getInterpolatedU(7.0D);
          d1 = (double) icon.getInterpolatedV(6.0D);
          d2 = (double) icon.getInterpolatedU(9.0D);
          d3 = (double) icon.getMaxV();
        }

        if (k1 == 0) {
          vec3 = avec3[0];
          vec31 = avec3[1];
          vec32 = avec3[2];
          vec33 = avec3[3];
        } else if (k1 == 1) {
          vec3 = avec3[7];
          vec31 = avec3[6];
          vec32 = avec3[5];
          vec33 = avec3[4];
        } else if (k1 == 2) {
          vec3 = avec3[1];
          vec31 = avec3[0];
          vec32 = avec3[4];
          vec33 = avec3[5];
        } else if (k1 == 3) {
          vec3 = avec3[2];
          vec31 = avec3[1];
          vec32 = avec3[5];
          vec33 = avec3[6];
        } else if (k1 == 4) {
          vec3 = avec3[3];
          vec31 = avec3[2];
          vec32 = avec3[6];
          vec33 = avec3[7];
        } else if (k1 == 5) {
          vec3 = avec3[0];
          vec31 = avec3[3];
          vec32 = avec3[7];
          vec33 = avec3[4];
        }

        tessellator.addVertexWithUV(vec3.xCoord, vec3.yCoord, vec3.zCoord, d0, d3);
        tessellator.addVertexWithUV(vec31.xCoord, vec31.yCoord, vec31.zCoord, d2, d3);
        tessellator.addVertexWithUV(vec32.xCoord, vec32.yCoord, vec32.zCoord, d2, d1);
        tessellator.addVertexWithUV(vec33.xCoord, vec33.yCoord, vec33.zCoord, d0, d1);
      }
    }
    return true;
  }