@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 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);
  }
예제 #3
0
  @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 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);
    }
  }
예제 #5
0
  @Override
  public void renderInventoryBlock(Block b, int metadata, int modelId, RenderBlocks rb) {
    BlockTieredOre bt = (BlockTieredOre) b;
    Tessellator v5 = Tessellator.instance;

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

    boolean tier =
        bt.getProgressStage(metadata).isPlayerAtStage(Minecraft.getMinecraft().thePlayer);
    IIcon ico = tier ? bt.getBacking(metadata) : bt.getDisguise(metadata).getIcon(0, 0);

    if (!tier || !TieredOres.list[metadata].renderAsGeode()) {
      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, ico);
      v5.draw();

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

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

    if (tier) {
      if (TieredOres.list[metadata].renderAsGeode()) {
        GL11.glPushMatrix();
        GL11.glTranslated(-0.5, -0.5, -0.5);
        v5.startDrawingQuads();
        this.renderGeode(null, 0, 0, 0, bt, metadata, rb);
        v5.draw();
        GL11.glPopMatrix();
      } else {
        ico = ((BlockTieredOre) b).getOverlay(metadata);
        v5.startDrawingQuads();
        v5.setNormal(0.0F, -1.0F, 0.0F);
        rb.renderFaceYNeg(b, 0.0D, 0.0D, 0.0D, ico);
        v5.draw();

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

        v5.startDrawingQuads();
        v5.setNormal(0.0F, 0.0F, -1.0F);
        rb.renderFaceZNeg(b, 0.0D, 0.0D, 0.0D, ico);
        v5.draw();
        v5.startDrawingQuads();
        v5.setNormal(0.0F, 0.0F, 1.0F);
        rb.renderFaceZPos(b, 0.0D, 0.0D, 0.0D, ico);
        v5.draw();
        v5.startDrawingQuads();
        v5.setNormal(-1.0F, 0.0F, 0.0F);
        rb.renderFaceXNeg(b, 0.0D, 0.0D, 0.0D, ico);
        v5.draw();
        v5.startDrawingQuads();
        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);
  }