@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;
 }
Пример #2
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;
  }
Пример #3
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;
  }
  @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);
    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);
    TileEntityColorLock te = (TileEntityColorLock) world.getTileEntity(x, y, z);

    if (!te.isHeldOpen()) {
      Collection<CrystalElement> c = te.getClosedColors();
      if (!c.isEmpty()) {
        v5.addTranslation(x, y, z);
        IIcon[] ico = new IIcon[] {ChromaIcons.BASICFADE.getIcon(), ChromaIcons.FRAME.getIcon()};
        int s = c.size();
        double iy = 0.0625;
        double dx = 0.0625;
        // s will never be more than 4
        double spc = 0.03125;
        double w = (1D - (dx * 2D) - spc * (s - 1)) / s;
        double sp = spc + w;
        double o = 0.005;
        for (CrystalElement e : c) {
          // if (!BlockColoredLock.isOpen(e, te.getChannel())) { does not work on servers
          for (int i = 0; i < ico.length; i++) {
            if (i == 0) {
              int clr =
                  ReikaColorAPI.getColorWithBrightnessMultiplier(
                      ReikaColorAPI.getModifiedSat(e.getColor(), 0.85F), 0.85F);
              v5.setColorRGBA_I(clr, 192);
              v5.setBrightness(240);
            } else {
              v5.setColorOpaque_I(0xffffff);
              v5.setBrightness(b.getMixedBrightnessForBlock(world, x, y, z));
            }

            for (int k = 0; k < 4; k++) {

              float u = ico[i].getMinU();
              float v = ico[i].getMinV();
              float du = ico[i].getMaxU();
              float dv = ico[i].getMaxV();

              if (k == 0 || k == 3) {
                float scr = v;
                v = dv;
                dv = scr;
              }

              switch (k) {
                case 0:
                  v5.addVertexWithUV(1 + o, dx, iy, du, v);
                  v5.addVertexWithUV(1 + o, dx + w, iy, u, v);
                  v5.addVertexWithUV(1 + o, dx + w, 1 - iy, u, dv);
                  v5.addVertexWithUV(1 + o, dx, 1 - iy, du, dv);
                  break;
                case 1:
                  v5.addVertexWithUV(1 - iy, dx, 1 + o, du, dv);
                  v5.addVertexWithUV(1 - iy, dx + w, 1 + o, u, dv);
                  v5.addVertexWithUV(iy, dx + w, 1 + o, u, v);
                  v5.addVertexWithUV(iy, dx, 1 + o, du, v);
                  break;
                case 2:
                  v5.addVertexWithUV(-o, dx, 1 - iy, du, dv);
                  v5.addVertexWithUV(-o, dx + w, 1 - iy, u, dv);
                  v5.addVertexWithUV(-o, dx + w, iy, u, v);
                  v5.addVertexWithUV(-o, dx, iy, du, v);
                  break;
                case 3:
                  v5.addVertexWithUV(iy, dx, -o, du, v);
                  v5.addVertexWithUV(iy, dx + w, -o, u, v);
                  v5.addVertexWithUV(1 - iy, dx + w, -o, u, dv);
                  v5.addVertexWithUV(1 - iy, dx, -o, du, dv);
                  break;
              }
            }
          }

          dx += sp;
          // }
        }
        v5.addTranslation(-x, -y, -z);
      }
    }

    return true;
  }