Ejemplo n.º 1
0
  private void renderSimpleGeode(
      IBlockAccess world, int x, int y, int z, Block b, int meta, RenderBlocks rb) {
    IIcon icos = ((BlockTieredOre) b).getGeodeStoneIcon(Math.abs(x + y * x * z + z) % 16);
    IIcon ico = ((BlockTieredOre) b).getGeodeIcon(meta);

    if (b.shouldSideBeRendered(world, x, y - 1, z, ForgeDirection.DOWN.ordinal()))
      rb.renderFaceYNeg(b, x, y, z, icos);
    if (b.shouldSideBeRendered(world, x, y + 1, z, ForgeDirection.UP.ordinal()))
      rb.renderFaceYPos(b, x, y, z, icos);
    if (b.shouldSideBeRendered(world, x, y, z - 1, ForgeDirection.NORTH.ordinal()))
      rb.renderFaceZNeg(b, x, y, z, icos);
    if (b.shouldSideBeRendered(world, x, y, z + 1, ForgeDirection.SOUTH.ordinal()))
      rb.renderFaceZPos(b, x, y, z, icos);
    if (b.shouldSideBeRendered(world, x - 1, y, z, ForgeDirection.WEST.ordinal()))
      rb.renderFaceXNeg(b, x, y, z, icos);
    if (b.shouldSideBeRendered(world, x + 1, y, z, ForgeDirection.EAST.ordinal()))
      rb.renderFaceXPos(b, x, y, z, icos);

    Tessellator.instance.setBrightness(240);
    Tessellator.instance.setColorOpaque(255, 255, 255);
    double d = 0.0025;

    if (b.shouldSideBeRendered(world, x, y - 1, z, ForgeDirection.DOWN.ordinal()))
      rb.renderFaceYNeg(b, x, y + d, z, ico);
    if (b.shouldSideBeRendered(world, x, y + 1, z, ForgeDirection.UP.ordinal()))
      rb.renderFaceYPos(b, x, y - d, z, ico);
    if (b.shouldSideBeRendered(world, x, y, z - 1, ForgeDirection.NORTH.ordinal()))
      rb.renderFaceZNeg(b, x, y, z + d, ico);
    if (b.shouldSideBeRendered(world, x, y, z + 1, ForgeDirection.SOUTH.ordinal()))
      rb.renderFaceZPos(b, x, y, z - d, ico);
    if (b.shouldSideBeRendered(world, x - 1, y, z, ForgeDirection.WEST.ordinal()))
      rb.renderFaceXNeg(b, x + d, y, z, ico);
    if (b.shouldSideBeRendered(world, x + 1, y, z, ForgeDirection.EAST.ordinal()))
      rb.renderFaceXPos(b, x - d, y, z, ico);
  }
Ejemplo n.º 2
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();
  }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
0
 public static void drawBlock(Block block, IIcon icon, 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, icon);
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 1.0F, 0.0F);
   renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, icon);
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 0.0F, -1.0F);
   renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, icon);
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 0.0F, 1.0F);
   renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, icon);
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(-1.0F, 0.0F, 0.0F);
   renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, icon);
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(1.0F, 0.0F, 0.0F);
   renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, icon);
   tessellator.draw();
 }
Ejemplo n.º 5
0
 public void drawFace(
     ForgeDirection side,
     Block block,
     double x,
     double y,
     double z,
     Icon icon,
     RenderBlocks renderer) {
   switch (side) {
     case UP:
       renderer.renderFaceYPos(block, x, y, z, icon);
       break;
     case DOWN:
       renderer.renderFaceYNeg(block, x, y, z, icon);
       break;
     case NORTH:
       renderer.renderFaceZNeg(block, x, y, z, icon);
       break;
     case EAST:
       renderer.renderFaceXPos(block, x, y, z, icon);
       break;
     case SOUTH:
       renderer.renderFaceZPos(block, x, y, z, icon);
       break;
     case WEST:
       renderer.renderFaceXNeg(block, x, y, z, icon);
       break;
     case UNKNOWN:
       break;
   }
 }
 @Override
 public boolean renderWorldBlock(
     IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks rb) {
   Tessellator v5 = Tessellator.instance;
   int meta = world.getBlockMetadata(x, y, z);
   if (renderPass == 0) {
     int color = b.colorMultiplier(world, x, y, z);
     float red = ReikaColorAPI.getRed(color) / 255F;
     float grn = ReikaColorAPI.getGreen(color) / 255F;
     float blu = ReikaColorAPI.getBlue(color) / 255F;
     rb.renderStandardBlockWithAmbientOcclusion(b, x, y, z, red, grn, blu);
     return true;
   } else if (renderPass == 1) {
     LightedTreeBlock ltb = (LightedTreeBlock) b;
     IIcon ico = ltb.getOverlay(meta);
     v5.setBrightness(240);
     v5.setColorRGBA_I(0xffffff, b instanceof BlockLeavesBase ? 255 : 220);
     if (ltb.renderOverlayOnSide(0, meta)) rb.renderFaceYNeg(b, x, y, z, ico);
     if (ltb.renderOverlayOnSide(1, meta)) rb.renderFaceYPos(b, x, y, z, ico);
     if (ltb.renderOverlayOnSide(2, meta)) rb.renderFaceZNeg(b, x, y, z, ico);
     if (ltb.renderOverlayOnSide(3, meta)) rb.renderFaceZPos(b, x, y, z, ico);
     if (ltb.renderOverlayOnSide(4, meta)) rb.renderFaceXNeg(b, x, y, z, ico);
     if (ltb.renderOverlayOnSide(5, meta)) rb.renderFaceXPos(b, x, y, z, ico);
     return true;
   }
   return false;
 }
 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);
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 10
0
  public static void renderRodInInventory(Block block, int metadata, RenderBlocks renderer) {

    renderer.setRenderBounds(0.375F, 0.375F, 0.01F, 0.625F, 0.625F, 0.99F);
    renderer.uvRotateSouth = 2;
    renderer.uvRotateNorth = 1;
    renderer.uvRotateTop = 3;
    renderer.uvRotateBottom = 3;

    if (block instanceof BaseBlock) {
      if (((BaseBlock) block).data instanceof BRodPart) {
        renderer.setRenderBounds(0.375F, 0.375F, 0.01F, 0.625F, 0.625F, 0.50F);
        GL11.glTranslatef(0F, 0F, 0.25F);
      }
    }

    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, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    renderer.renderFaceYPos(
        block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    renderer.renderFaceZNeg(
        block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    renderer.renderFaceZPos(
        block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    renderer.renderFaceXNeg(
        block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    renderer.renderFaceXPos(
        block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata));
    tessellator.draw();
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);

    renderer.uvRotateEast = 0;
    renderer.uvRotateWest = 0;
    renderer.uvRotateSouth = 0;
    renderer.uvRotateNorth = 0;
    renderer.uvRotateTop = 0;
    renderer.uvRotateBottom = 0;
    renderer.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
  }
Ejemplo n.º 11
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks rb) {
    Tessellator v5 = Tessellator.instance;
    int meta = world.getBlockMetadata(x, y, z);
    /*
    float f1 = 0.5F;
    float f2 = 1;
    float f3 = 0.8F;
    float f4 = 0.8F;
    float f5 = 0.6F;
    float f6 = 0.6F;


    v5.setBrightness(rb.renderMinY > 0.0D ? l : b.getMixedBrightnessForBlock(world, x, y - 1, z));
    v5.setColorOpaque_F(f1, f1, f1);
    rb.renderFaceYNeg(b, x, y, z, ico);

    v5.setBrightness(rb.renderMaxY < 1.0D ? l : b.getMixedBrightnessForBlock(world, x, y + 1, z));
    v5.setColorOpaque_F(f2, f2, f2);
    rb.renderFaceYPos(b, x, y, z, ico);

    v5.setBrightness(rb.renderMinZ > 0.0D ? l : b.getMixedBrightnessForBlock(world, x, y, z - 1));
    v5.setColorOpaque_F(f3, f3, f3);
    rb.renderFaceZNeg(b, x, y, z, ico);

    v5.setBrightness(rb.renderMaxZ < 1.0D ? l : b.getMixedBrightnessForBlock(world, x, y, z + 1));
    v5.setColorOpaque_F(f4, f4, f4);
    rb.renderFaceZPos(b, x, y, z, ico);

    v5.setBrightness(rb.renderMinX > 0.0D ? l : b.getMixedBrightnessForBlock(world, x - 1, y, z));
    v5.setColorOpaque_F(f5, f5, f5);
    rb.renderFaceXNeg(b, x, y, z, ico);

    v5.setBrightness(rb.renderMaxX < 1.0D ? l : b.getMixedBrightnessForBlock(world, x + 1, y, z));
    v5.setColorOpaque_F(f6, f6, f6);
    rb.renderFaceXPos(b, x, y, z, ico);
     */
    rb.renderStandardBlockWithAmbientOcclusion(b, x, y, z, 1, 1, 1);

    IIcon ico = CrystalElement.elements[meta].getFaceRune();
    v5.setBrightness(240);
    v5.setColorOpaque_F(255, 255, 255);
    if (b.shouldSideBeRendered(world, x, y - 1, z, ForgeDirection.DOWN.ordinal()))
      rb.renderFaceYNeg(b, x, y, z, ico);
    if (b.shouldSideBeRendered(world, x, y + 1, z, ForgeDirection.UP.ordinal()))
      rb.renderFaceYPos(b, x, y, z, ico);
    if (b.shouldSideBeRendered(world, x, y, z - 1, ForgeDirection.NORTH.ordinal()))
      rb.renderFaceZNeg(b, x, y, z, ico);
    if (b.shouldSideBeRendered(world, x, y, z + 1, ForgeDirection.SOUTH.ordinal()))
      rb.renderFaceZPos(b, x, y, z, ico);
    if (b.shouldSideBeRendered(world, x - 1, y, z, ForgeDirection.WEST.ordinal()))
      rb.renderFaceXNeg(b, x, y, z, ico);
    if (b.shouldSideBeRendered(world, x + 1, y, z, ForgeDirection.EAST.ordinal()))
      rb.renderFaceXPos(b, x, y, z, ico);
    return true;
  }
Ejemplo n.º 12
0
 public static void renderAllFaces(
     RenderBlocks renderer, Block block, int x, int y, int z, IIcon icon) {
   renderer.renderFaceYNeg(block, x, y, z, icon);
   renderer.renderFaceYPos(block, x, y, z, icon);
   renderer.renderFaceZNeg(block, x, y, z, icon);
   renderer.renderFaceZPos(block, x, y, z, icon);
   renderer.renderFaceXNeg(block, x, y, z, icon);
   renderer.renderFaceXPos(block, x, y, z, icon);
 }
Ejemplo n.º 13
0
  @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 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);
  }
Ejemplo n.º 15
0
  public static void renderRodWithNBT(ItemStack stack, RenderBlocks renderer) {

    renderer.setRenderBounds(0.375F, 0.375F, 0.01F, 0.625F, 0.625F, 0.99F);
    renderer.uvRotateSouth = 2;
    renderer.uvRotateNorth = 1;
    renderer.uvRotateTop = 3;
    renderer.uvRotateBottom = 3;

    Tessellator tessellator = Tessellator.instance;
    Block block = BlockData.rod.block;

    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, ItemData.rod.item.getIcon(stack, 0));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, ItemData.rod.item.getIcon(stack, 1));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, ItemData.rod.item.getIcon(stack, 2));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, ItemData.rod.item.getIcon(stack, 3));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, ItemData.rod.item.getIcon(stack, 4));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, ItemData.rod.item.getIcon(stack, 5));
    tessellator.draw();

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);

    renderer.uvRotateEast = 0;
    renderer.uvRotateWest = 0;
    renderer.uvRotateSouth = 0;
    renderer.uvRotateNorth = 0;
    renderer.uvRotateTop = 0;
    renderer.uvRotateBottom = 0;
    renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  }
 private void renderInvCuboid(
     RenderBlocks renderer,
     Block block,
     float minX,
     float minY,
     float minZ,
     float maxX,
     float maxY,
     float maxZ,
     Icon icon) {
   Tessellator tessellator = Tessellator.instance;
   block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
   renderer.setRenderBoundsFromBlock(block);
   GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
   block.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
   renderer.setRenderBoundsFromBlock(block);
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, -1F, 0.0F);
   renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, icon);
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 1.0F, 0.0F);
   renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, icon);
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 0.0F, -1F);
   renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, icon);
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 0.0F, 1.0F);
   renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, icon);
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(-1F, 0.0F, 0.0F);
   renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, icon);
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(1.0F, 0.0F, 0.0F);
   renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, icon);
   tessellator.draw();
   GL11.glTranslatef(0.5F, 0.5F, 0.5F);
   block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
   renderer.setRenderBoundsFromBlock(block);
 }
  @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 block, int metadata, int modelID, RenderBlocks renderer) {
   int meta = 3;
   if (block == Evercraft_Blocks.blockplatemillOn) meta = 1;
   Tessellator tessellator = Tessellator.instance;
   block.setBlockBoundsForItemRender();
   renderer.setRenderBoundsFromBlock(block);
   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);
   renderer.renderFaceYNeg(
       block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, meta));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 1.0F, 0.0F);
   renderer.renderFaceYPos(
       block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, meta));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 0.0F, -1.0F);
   renderer.renderFaceZNeg(
       block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, meta));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 0.0F, 1.0F);
   renderer.renderFaceZPos(
       block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, meta));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(-1.0F, 0.0F, 0.0F);
   renderer.renderFaceXNeg(
       block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, meta));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(1.0F, 0.0F, 0.0F);
   renderer.renderFaceXPos(
       block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, meta));
   tessellator.draw();
   GL11.glTranslatef(0.5F, 0.5F, 0.5F);
 }
 private void renderPostAtOrigin(
     BlockThinLogFence block, int metadata, RenderBlocks renderer, Tessellator tessellator) {
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, -1.0F, 0.0F);
   renderer.renderFaceYNeg(
       block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 1.0F, 0.0F);
   renderer.renderFaceYPos(
       block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata));
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 0.0F, -1.0F);
   renderer.renderFaceZNeg(
       block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata));
   renderer.renderFaceZNeg(block, 0, 0, .5f, block.getSideIcon());
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(0.0F, 0.0F, 1.0F);
   renderer.renderFaceZPos(
       block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata));
   renderer.renderFaceZPos(block, 0, 0, -.5f, block.getSideIcon());
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(-1.0F, 0.0F, 0.0F);
   renderer.renderFaceXNeg(
       block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata));
   renderer.renderFaceXNeg(block, .5f, 0, 0, block.getSideIcon());
   tessellator.draw();
   tessellator.startDrawingQuads();
   tessellator.setNormal(1.0F, 0.0F, 0.0F);
   renderer.renderFaceXPos(
       block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata));
   renderer.renderFaceXPos(block, -.5f, 0, 0, block.getSideIcon());
   tessellator.draw();
 }
Ejemplo n.º 20
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks rb) {
    Tessellator v5 = Tessellator.instance;
    int meta = world.getBlockMetadata(x, y, z);

    BlockTieredOre t = (BlockTieredOre) b;
    if (t.isPlayerSufficientTier(world, x, y, z, Minecraft.getMinecraft().thePlayer)) {
      if (TieredOres.list[meta].renderAsGeode()) {
        this.renderGeode(world, x, y, z, b, meta, rb);
        // this.renderSimpleGeode(world, x, y, z, b, meta, rb);
      } else {
        rb.renderStandardBlockWithAmbientOcclusion(b, x, y, z, 1, 1, 1);

        IIcon ico = t.getOverlay(meta);
        v5.setBrightness(240);
        v5.setColorOpaque(255, 255, 255);
        if (b.shouldSideBeRendered(world, x, y - 1, z, ForgeDirection.DOWN.ordinal()))
          rb.renderFaceYNeg(b, x, y, z, ico);
        if (b.shouldSideBeRendered(world, x, y + 1, z, ForgeDirection.UP.ordinal()))
          rb.renderFaceYPos(b, x, y, z, ico);
        if (b.shouldSideBeRendered(world, x, y, z - 1, ForgeDirection.NORTH.ordinal()))
          rb.renderFaceZNeg(b, x, y, z, ico);
        if (b.shouldSideBeRendered(world, x, y, z + 1, ForgeDirection.SOUTH.ordinal()))
          rb.renderFaceZPos(b, x, y, z, ico);
        if (b.shouldSideBeRendered(world, x - 1, y, z, ForgeDirection.WEST.ordinal()))
          rb.renderFaceXNeg(b, x, y, z, ico);
        if (b.shouldSideBeRendered(world, x + 1, y, z, ForgeDirection.EAST.ordinal()))
          rb.renderFaceXPos(b, x, y, z, ico);
      }
    } else {
      rb.renderBlockAllFaces(t.getDisguise(meta), x, y, z);
      // rb.renderStandardBlockWithAmbientOcclusion(t.getDisguise(), x, y, z, 1, 1, 1);
    }
    return true;
  }
Ejemplo n.º 21
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);
      }
    }
  }
  @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);
  }
Ejemplo n.º 23
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);
  }
Ejemplo n.º 24
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);
  }
Ejemplo n.º 25
0
  @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;
    }
  }
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    if (modelId == RENDER_ID) {
      final BlockBrewKettle brewKettle = (BlockBrewKettle) block;
      final double d = 0.0625D;
      float f = 1.0F;
      renderer.renderStandardBlock(block, x, y, z);
      final Tessellator tes = Tessellator.instance;
      tes.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
      int color = block.colorMultiplier(world, 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;
      float f4;

      if (EntityRenderer.anaglyphEnable) {
        final float f5 = (r * 30.0F + g * 59.0F + b * 11.0F) / 100.0F;
        f4 = (r * 30.0F + g * 70.0F) / 100.0F;
        final float f6 = (r * 30.0F + b * 70.0F) / 100.0F;
        r = f5;
        g = f4;
        b = f6;
      }

      tes.setColorOpaque_F(f * r, f * g, f * b);
      f4 = 0.125F;
      renderer.renderFaceXPos(
          block, (double) (x - 1.0F + f4), (double) y, (double) z, brewKettle.getIconByIndex(2));
      renderer.renderFaceXNeg(
          block, (double) (x + 1.0F - f4), (double) y, (double) z, brewKettle.getIconByIndex(2));
      renderer.renderFaceZPos(
          block, (double) x, (double) y, (double) (z - 1.0F + f4), brewKettle.getIconByIndex(2));
      renderer.renderFaceZNeg(
          block, (double) x, (double) y, (double) (z + 1.0F - f4), brewKettle.getIconByIndex(2));
      renderer.renderFaceYPos(
          block, (double) x, (double) (y - 1.0F + 0.25F), (double) z, brewKettle.getIconByIndex(1));
      renderer.renderFaceYNeg(
          block, (double) x, (double) (y + 1.0F - 0.75F), (double) z, brewKettle.getIconByIndex(1));

      // Render Liquid
      final TileEntityBrewKettle te = (TileEntityBrewKettle) world.getTileEntity(x, y, z);
      if (te != null) {
        for (int i = 0; i < 2; ++i) {
          if (te.isFluidTankFilled(i)) {
            final Fluid fluid = te.getFluid(i);
            color = fluid.getColor();
            r = (float) (color >> 16 & 255) / 255.0F;
            g = (float) (color >> 8 & 255) / 255.0F;
            b = (float) (color & 255) / 255.0F;
            f = 1.0F;
            tes.setColorOpaque_F(f * r, f * g, f * b);
            f = te.getFluidAmount(i) * FLUID_HEIGHT / te.getFluidTank(i).getCapacity();
            renderer.setRenderBounds(2 * d, 0.0D, 2 * d, 14 * d, (double) (0.25F + f), 14 * d);
            renderer.renderFaceYPos(block, (double) x, (double) y, (double) z, fluid.getIcon());
          }
        }
      }

      renderer.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
    }
    return true;
  }