Ejemplo n.º 1
0
  public EntityDiggingFX func_174845_l() {
    Block block = this.field_174847_a.getBlock();

    if (block == Blocks.grass) {
      return this;
    } else {
      int i = block.getRenderColor(this.field_174847_a);
      this.particleRed *= (float) (i >> 16 & 255) / 255.0F;
      this.particleGreen *= (float) (i >> 8 & 255) / 255.0F;
      this.particleBlue *= (float) (i & 255) / 255.0F;
      return this;
    }
  }
  @Override
  public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    Tessellator tessellator = Tessellator.instance;
    Icon icon = renderer.getBlockIcon(block);

    float red = 1.0F;
    float green = 1.0F;
    float blue = 1.0F;

    if (renderer.useInventoryTint) {
      int var6 = block.getRenderColor(metadata);

      red = (float) (var6 >> 16 & 255) / 255.0F;
      green = (float) (var6 >> 8 & 255) / 255.0F;
      blue = (float) (var6 & 255) / 255.0F;
    }

    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glScalef(1.5F, 1.5F, 1.5F);
    GL11.glTranslatef(-0.5F, -0.4F, -0.5F);
    GL11.glColor4f(red, green, blue, 1.0F);
    GL11.glEnable(GL11.GL_CULL_FACE);

    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.startDrawingQuads();
    {
      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);

    minX = 0.25F;
    maxX = 0.75F;
    minY = 10.0F / 16.0F;
    maxY = 15.0F / 16.0F;
    minZ = 0.5F;
    maxZ = 0.5F;

    {
      tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
      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(1.0F, 1.0F, 1.0F);
      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);
    }

    tessellator.draw();

    /*tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -1.0F, 0.0F);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    tessellator.draw();*/

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    GL11.glDisable(GL11.GL_CULL_FACE);
  }
Ejemplo n.º 3
0
  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);
      }
    }
  }