@Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    int meta = world.getBlockMetadata(x, y, z);
    boolean hpos = (meta & 1) == 1;
    boolean vpos = (meta & 2) == 2;
    boolean dir = (meta & 4) == 4;
    boolean closed = (meta & 8) == 8;

    if (!vpos) { // bottom
      renderer.setRenderBounds(0, 0, 0, 1, .1f, 1);
    } else { // top
      renderer.setRenderBounds(0, .9f, 0, 1, 1, 1);
    }
    renderer.renderStandardBlock(block, x, y, z);

    if (!dir) {
      if (!hpos) {
        renderer.setRenderBounds(0, 0, 0, .1f, 1, 1);
      } else {
        renderer.setRenderBounds(.9f, 0, 0, 1, 1, 1);
      }
    } else {
      if (!hpos) {
        renderer.setRenderBounds(0, 0, 0, 1, 1, .1f);
      } else {
        renderer.setRenderBounds(0, 0, .9f, 1, 1, 1);
      }
    }
    renderer.renderStandardBlock(block, x, y, z);

    return true;
  }
 @Override
 public boolean renderWorldBlock(
     IBlockAccess blockAccess,
     int x,
     int y,
     int z,
     Block block,
     int modelID,
     RenderBlocks renderer) {
   switch (modelID) {
     case 90:
       return renderBlockCrossedSquares(blockAccess, x, y, z, block, modelID, renderer);
     case 102:
       return renderer.renderStandardBlock(block, x, y, z);
     case 103:
       return renderBlockMetalLadder(
           blockAccess, x, y, z, (BlockMetalLadder) block, modelID, renderer);
     case 110:
       return renderer.renderStandardBlock(block, x, y, z);
     case 111:
       return renderBlockWoodLadder(
           blockAccess, x, y, z, (BlockWoodLadder) block, modelID, renderer);
   }
   return false;
 }
Ejemplo n.º 3
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    for (int i = 0; i < _caseBounds.length; i++) {
      BoundTransform boundTransform = _caseBounds[i];
      Bound bound = boundTransform.Bound.copy();

      setBound(bound, renderer);
      renderer.renderStandardBlock(block, x, y, z);

      if (boundTransform.Transforms == null) continue;

      for (int j = 0; j < boundTransform.Transforms.length; j++) {
        PointF p = boundTransform.Transforms[j];

        bound.MinX += p.X;
        bound.MinY += p.Y;
        bound.MinZ += p.Z;
        bound.MaxX += p.X;
        bound.MaxY += p.Y;
        bound.MaxZ += p.Z;

        setBound(bound, renderer);
        renderer.renderStandardBlock(block, x, y, z);
        ;
      }
    }

    return true;
  }
Ejemplo n.º 4
0
  private void renderPassWorld(
      int pass,
      BlockBuildCraft block,
      int meta,
      RenderBlocks renderer,
      IBlockAccess world,
      int x,
      int y,
      int z) {
    if (block.isRotatable()) {
      renderer.uvRotateTop = Y_ROTATE[block.getFrontSide(meta) - 2];
      renderer.uvRotateBottom = Y_ROTATE[block.getFrontSide(meta) - 2];
    }

    double pDouble = (pass > 0 ? 1 : 0) / 512.0;
    renderer.setRenderBounds(
        block.getBlockBoundsMinX() - pDouble,
        block.getBlockBoundsMinY() - pDouble,
        block.getBlockBoundsMinZ() - pDouble,
        block.getBlockBoundsMaxX() + pDouble,
        block.getBlockBoundsMaxY() + pDouble,
        block.getBlockBoundsMaxZ() + pDouble);

    renderer.renderStandardBlock(block, x, y, z);

    renderer.uvRotateTop = 0;
    renderer.uvRotateBottom = 0;
  }
  @Override
  public boolean renderWorldBlock(
      final IBlockAccess world,
      int x,
      int y,
      int z,
      BlockWorkingProjector block,
      int modelId,
      RenderBlocks renderer) {
    if (ForgeHooksClient.getWorldRenderPass() == 0) {
      renderer.renderStandardBlock(block, x, y, z);
      return true;
    }

    if (!Config.renderHoloCone) return false;
    if (ForgeHooksClient.getWorldRenderPass() != 1) return false; // Just in case something breaks

    final Tessellator tex = Tessellator.instance;
    tex.addTranslation(x, y + TO_BLOCK_CENTRE, z);

    if (Config.coneBrightness != BRIGHTNESS_LEVEL_DEF) {
      tex.setBrightness(
          Math.max(BRIGHTNESS_LEVEL_MIN, Math.min(Config.coneBrightness, BRIGHTNESS_LEVEL_MAX)));
    }

    renderCoreWithTex(block.getIcon(world, x, y, z, -1), tex);

    tex.addTranslation(-x, -(y + TO_BLOCK_CENTRE), -z);

    return true;
  }
Ejemplo n.º 6
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
    if (modelID == model) {
      renderer.renderStandardBlock(block, x, y, z);
      renderer.setRenderBounds(0f, 0f, 0f, 1f, 0.5f, 1f);
      int metadata = world.getBlockMetadata(x, y, z);
      BlockSkinRenderHelper.renderLiquidBlock(
          ((SlimePad) block).getFluidIcon(metadata),
          ((SlimePad) block).getFluidIcon(metadata),
          x,
          y,
          z,
          renderer,
          world);

      float[] size = size(metadata % 8);
      renderer.setRenderBounds(size[0], 0.5f, size[1], size[2], 0.6875f, size[3]);
      BlockSkinRenderHelper.renderLiquidBlock(
          ((SlimePad) block).getNubIcon(metadata),
          ((SlimePad) block).getNubIcon(metadata),
          x,
          y,
          z,
          renderer,
          world);
    }
    return true;
  }
Ejemplo n.º 7
0
  public static void renderCubes(
      IBlockAccess world,
      ArrayList<CubeObject> cubes,
      int x,
      int y,
      int z,
      Block block,
      RenderBlocks renderer,
      ForgeDirection direction,
      ExtendedRenderBlocks extraRenderer) {
    for (int i = 0; i < cubes.size(); i++) {

      if (cubes.get(i).icon != null) renderer.setOverrideBlockTexture(cubes.get(i).icon);

      if (cubes.get(i).block != null)
        if (cubes.get(i).meta != -1) {
          if (fake == null) {
            fake = new IBlockAccessFake(renderer.blockAccess);
            extraRenderer.blockAccess = fake;
          }

          if (fake.world != renderer.blockAccess) fake.world = renderer.blockAccess;

          extraRenderer.clearOverrideBlockTexture();
          extraRenderer.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);
          extraRenderer.meta = cubes.get(i).meta;
          fake.overrideMeta = cubes.get(i).meta;
          extraRenderer.color = cubes.get(i).color;
          extraRenderer.lockBlockBounds = true;
          extraRenderer.renderBlockAllFaces(cubes.get(i).block, x, y, z);
          extraRenderer.lockBlockBounds = false;
          extraRenderer.color = ColorUtils.WHITE;
          continue;
        } else renderer.setOverrideBlockTexture(cubes.get(i).block.getBlockTextureFromSide(0));

      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 (direction != null
          && direction != ForgeDirection.EAST
          && direction != ForgeDirection.UNKNOWN)
        RenderHelper3D.applyBlockRotation(renderer, direction);

      renderer.renderStandardBlock(block, x, y, z);

      if (cubes.get(i).icon != null || cubes.get(i).block != null)
        renderer.clearOverrideBlockTexture();
    }
  }
 @Override
 public boolean renderWorldBlock(
     IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
   if (modelId == id) {
     final double d = 0.0625D;
     // LEGS
     renderer.setRenderBounds(3 * d, 0.0D, 3 * d, 5 * d, 3 * d, 5 * d);
     renderer.renderStandardBlock(block, x, y, z);
     renderer.setRenderBounds(11 * d, 0.0D, 3 * d, 13 * d, 3 * d, 5 * d);
     renderer.renderStandardBlock(block, x, y, z);
     renderer.setRenderBounds(3 * d, 0.0D, 11 * d, 5 * d, 3 * d, 13 * d);
     renderer.renderStandardBlock(block, x, y, z);
     renderer.setRenderBounds(11 * d, 0.0D, 11 * d, 13 * d, 3 * d, 13 * d);
     renderer.renderStandardBlock(block, x, y, z);
     // BODY
     renderer.setRenderBounds(1 * d, 3 * d, 1 * d, 15 * d, 10 * d, 15 * d);
     renderer.renderStandardBlock(block, x, y, z);
     // ROOF
     renderer.setRenderBounds(0.0D, 10 * d, 0.0D, 1.0D, 13 * d, 1.0D);
     renderer.renderStandardBlock(block, x, y, z);
     renderer.setRenderBounds(2 * d, 13 * d, 2 * d, 14 * d, 1.0D, 14 * d);
     renderer.renderStandardBlock(block, x, y, z);
   }
   return true;
 }
  public void renderBlockMeteor(
      RenderBlocks renderBlocks, Block par1Block, IBlockAccess var1, int par2, int par3, int par4) {
    var1.getBlockMetadata(par2, par3, par4);

    renderBlocks.setRenderBounds(0.2F, 0.0F, 0.2F, 0.8F, 0.5F, 0.8F);
    renderBlocks.renderStandardBlock(par1Block, par2, par3, par4);

    renderBlocks.setRenderBounds(0.52F, 0.0F, 0.4F, 0.68F, 0.68F, 0.6F);
    renderBlocks.renderStandardBlock(par1Block, par2, par3, par4);

    renderBlocks.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.65F, 0.75F);
    renderBlocks.renderStandardBlock(par1Block, par2, par3, par4);

    renderBlocks.setRenderBounds(0.15F, 0.0F, 0.25F, 0.2F, 0.4F, 0.75F);
    renderBlocks.renderStandardBlock(par1Block, par2, par3, par4);

    renderBlocks.setRenderBounds(0.8F, 0.0F, 0.25F, 0.85F, 0.4F, 0.75F);
    renderBlocks.renderStandardBlock(par1Block, par2, par3, par4);

    renderBlocks.setRenderBounds(0.25F, 0.0F, 0.1F, 0.75F, 0.4F, 0.2F);
    renderBlocks.renderStandardBlock(par1Block, par2, par3, par4);

    renderBlocks.setRenderBounds(0.25F, 0.0F, 0.8F, 0.75F, 0.4F, 0.9F);
    renderBlocks.renderStandardBlock(par1Block, par2, par3, par4);

    renderBlocks.clearOverrideBlockTexture();
    par1Block.setBlockBoundsForItemRender();
    renderBlocks.uvRotateTop = 0;
  }
  private boolean renderSponge(
      RenderBlocks var1, IBlockAccess var2, int var3, int var4, int var5, Block var6) {
    int var7 = var2.getBlockMetadata(var3, var4, var5);
    if (var7 == 0) {
      var6.setBlockBounds(0.375F, 0.0F, 0.375F, 0.625F, 0.25F, 0.625F);
      var1.renderStandardBlock(var6, var3, var4, var5);
    } else if (var7 == 1) {
      var6.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
      var1.renderStandardBlock(var6, var3, var4, var5);
    } else if (var7 == 2) {
      var6.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.75F, 0.875F);
      var1.renderStandardBlock(var6, var3, var4, var5);
    }

    var1.renderBlockLiquid(Blocks.water, var3, var4, var5);

    return true;
  }
 @Override
 public boolean renderWorldBlock(
     IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
   int direction = renderer.blockAccess.getBlockMetadata(x, y, z) & 3;
   if (direction > 0) renderer.uvRotateTop = direction - 1;
   else renderer.uvRotateTop = 3;
   boolean flag = renderer.renderStandardBlock(block, x, y, z);
   renderer.uvRotateTop = 0;
   return flag;
 }
  public boolean renderAlgae(
      IBlockAccess world, int x, int y, int z, Block block, RenderBlocks renderer) {

    block.setBlockBounds(0.0F, 0.0F - 0.125F, 0.0F, 1.0F, 0.0F - 0.0625F, 1.0F);
    renderer.renderStandardBlock(block, x, y, z);
    float var7 = 0.5F;
    float var8 = 0.015625F;
    block.setBlockBounds(0.5F - var7, 0.0F - 0.125F, 0.5F - var7, 0.5F + var7, var8, 0.5F + var7);
    return true;
  }
  @Override
  public boolean renderInWorld(
      final BlockSecurity imb,
      final IBlockAccess world,
      final int x,
      final int y,
      final int z,
      final RenderBlocks renderer) {
    final TileSecurity sp = imb.getTileEntity(world, x, y, z);
    renderer.setRenderBounds(0, 0, 0, 1, 1, 1);

    final ForgeDirection up = sp.getUp();

    this.preRenderInWorld(imb, world, x, y, z, renderer);

    final boolean result = renderer.renderStandardBlock(imb, x, y, z);

    int b = world.getLightBrightnessForSkyBlocks(x + up.offsetX, y + up.offsetY, z + up.offsetZ, 0);

    if (sp.isActive()) {
      b = 15 << 20 | 15 << 4;
    }

    Tessellator.instance.setBrightness(b);
    Tessellator.instance.setColorOpaque_I(0xffffff);
    renderer.setRenderBounds(0, 0, 0, 1, 1, 1);

    Tessellator.instance.setColorOpaque_I(sp.getColor().whiteVariant);
    IIcon ico =
        sp.isActive()
            ? ExtraBlockTextures.BlockMESecurityOn_Light.getIcon()
            : ExtraBlockTextures.MEChest.getIcon();
    this.renderFace(x, y, z, imb, ico, renderer, up);

    if (sp.isActive()) {
      Tessellator.instance.setColorOpaque_I(sp.getColor().mediumVariant);
      ico =
          sp.isActive()
              ? ExtraBlockTextures.BlockMESecurityOn_Medium.getIcon()
              : ExtraBlockTextures.MEChest.getIcon();
      this.renderFace(x, y, z, imb, ico, renderer, up);

      Tessellator.instance.setColorOpaque_I(sp.getColor().blackVariant);
      ico =
          sp.isActive()
              ? ExtraBlockTextures.BlockMESecurityOn_Dark.getIcon()
              : ExtraBlockTextures.MEChest.getIcon();
      this.renderFace(x, y, z, imb, ico, renderer, up);
    }

    renderer.overrideBlockTexture = null;
    this.postRenderInWorld(renderer);

    return result;
  }
 private boolean renderCoral(
     RenderBlocks var1, IBlockAccess var2, int var3, int var4, int var5, Block var6) {
   if (var2.getBlock(var3, var4, var5) instanceof BlockCoral) {
     if (var2.getBlockMetadata(var3, var4, var5) % 8 == 6) {
       var6.setBlockBounds(0.375F, 0.0F, 0.375F, 0.625F, 0.25F, 0.625F);
       var1.renderStandardBlock(var6, var3, var4, var5);
     } else if (var2.getBlockMetadata(var3, var4, var5) % 8 == 2) {
       var6.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
       var1.renderStandardBlock(var6, var3, var4, var5);
     } else {
       var6.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.75F, 0.75F);
       var1.renderCrossedSquares(var6, var3, var4, var5);
     }
   } else {
     var6.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.75F, 0.75F);
     var1.renderCrossedSquares(var6, var3, var4, var5);
   }
   var1.renderBlockLiquid(Blocks.water, var3, var4, var5);
   return true;
 }
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    renderer.renderStandardBlock(block, x, y, z);

    Tessellator ts = Tessellator.instance;
    ForgeDirection face = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
    BlockTerminalFluid terminalBlock = (BlockTerminalFluid) block;
    int[] color = {0, 0, 0};
    TileEntity blockTE = world.getBlockTileEntity(x, y, z);
    if (blockTE instanceof TileEntityTerminalFluid) {
      TileEntityTerminalFluid terminalTE = (TileEntityTerminalFluid) blockTE;
      switch (terminalTE.getColor()) {
        case -1:
          color = fluix.clone();
          break;
        case 0:
          color = blue.clone();
          break;
        case 1:
          color = black.clone();
          break;
        case 2:
          color = white.clone();
          break;
        case 3:
          color = brown.clone();
          break;
        case 4:
          color = red.clone();
          break;
        case 5:
          color = yellow.clone();
          break;
        case 6:
          color = green.clone();
          break;
      }

      boolean active = terminalTE.isMachineActive();

      ts.setBrightness(15 << 2 | 15 << 0);

      if (active) ts.setBrightness(15 << 20 | 15 << 4);

      ts.setColorOpaque_I(0xFFFFFF);
      drawFace(face, block, x, y, z, terminalBlock.baseLayer, renderer);
      for (int i = 0; i < 3; i++) {
        ts.setColorOpaque_I(color[i]);
        drawFace(face, block, x, y, z, terminalBlock.colorLayers[i], renderer);
      }
    }
    return true;
  }
Ejemplo n.º 16
0
  public static boolean renderRod1F(
      IBlockAccess world, int x, int y, int z, Block block, int facing, RenderBlocks renderer) {

    switch (facing) {
      case 0:
        renderer.uvRotateEast = 3;
        renderer.uvRotateWest = 3;
        renderer.uvRotateSouth = 3;
        renderer.uvRotateNorth = 3;
        renderer.setRenderBounds(0.375F, 0.625F, 0.375F, 0.625F, 0.75F, 0.625F);
        break;
      case 1:
        renderer.setRenderBounds(0.375F, 0.25F, 0.375F, 0.625F, 0.375F, 0.625F);
        break;
      case 2:
        renderer.uvRotateSouth = 1;
        renderer.uvRotateNorth = 2;
        renderer.setRenderBounds(0.375F, 0.375F, 0.625F, 0.625F, 0.625F, 0.75F);
        break;
      case 3:
        renderer.uvRotateSouth = 2;
        renderer.uvRotateNorth = 1;
        renderer.uvRotateTop = 3;
        renderer.uvRotateBottom = 3;
        renderer.setRenderBounds(0.375F, 0.375F, 0.25F, 0.625F, 0.625F, 0.375F);
        break;
      case 4:
        renderer.uvRotateEast = 1;
        renderer.uvRotateWest = 2;
        renderer.uvRotateTop = 2;
        renderer.uvRotateBottom = 1;
        renderer.setRenderBounds(0.625F, 0.375F, 0.375F, 0.75F, 0.625F, 0.625F);
        break;
      case 5:
        renderer.uvRotateEast = 2;
        renderer.uvRotateWest = 1;
        renderer.uvRotateTop = 1;
        renderer.uvRotateBottom = 2;
        renderer.setRenderBounds(0.25F, 0.375F, 0.375F, 0.375F, 0.625F, 0.625F);
    }

    renderer.renderStandardBlock(block, x, y, z);
    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);
    return true;
  }
Ejemplo n.º 17
0
  /* LEGACY PIPE RENDERING and quarry frames! */
  private void legacyPipeRender(
      RenderBlocks renderblocks,
      IBlockAccess iblockaccess,
      int i,
      int j,
      int k,
      Block block,
      int l) {
    float minSize = CoreConstants.PIPE_MIN_POS;
    float maxSize = CoreConstants.PIPE_MAX_POS;

    block.setBlockBounds(minSize, minSize, minSize, maxSize, maxSize, maxSize);
    renderblocks.setRenderBoundsFromBlock(block);
    renderblocks.renderStandardBlock(block, i, j, k);

    if (Utils.checkLegacyPipesConnections(iblockaccess, i, j, k, i - 1, j, k)) {
      block.setBlockBounds(0.0F, minSize, minSize, minSize, maxSize, maxSize);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, i, j, k);
    }

    if (Utils.checkLegacyPipesConnections(iblockaccess, i, j, k, i + 1, j, k)) {
      block.setBlockBounds(maxSize, minSize, minSize, 1.0F, maxSize, maxSize);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, i, j, k);
    }

    if (Utils.checkLegacyPipesConnections(iblockaccess, i, j, k, i, j - 1, k)) {
      block.setBlockBounds(minSize, 0.0F, minSize, maxSize, minSize, maxSize);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, i, j, k);
    }

    if (Utils.checkLegacyPipesConnections(iblockaccess, i, j, k, i, j + 1, k)) {
      block.setBlockBounds(minSize, maxSize, minSize, maxSize, 1.0F, maxSize);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, i, j, k);
    }

    if (Utils.checkLegacyPipesConnections(iblockaccess, i, j, k, i, j, k - 1)) {
      block.setBlockBounds(minSize, minSize, 0.0F, maxSize, maxSize, minSize);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, i, j, k);
    }

    if (Utils.checkLegacyPipesConnections(iblockaccess, i, j, k, i, j, k + 1)) {
      block.setBlockBounds(minSize, minSize, maxSize, maxSize, maxSize, 1.0F);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, i, j, k);
    }

    block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  }
  /* LEGACY PIPE RENDERING */
  private void legacyPipeRender(
      RenderBlocks renderblocks,
      IBlockAccess iblockaccess,
      int i,
      int j,
      int k,
      Block block,
      int l) {
    float minSize = Utils.pipeMinPos;
    float maxSize = Utils.pipeMaxPos;

    block.setBlockBounds(minSize, minSize, minSize, maxSize, maxSize, maxSize);
    renderblocks.func_83018_a(block);
    renderblocks.renderStandardBlock(block, i, j, k);

    if (Utils.checkLegacyPipesConnections(iblockaccess, i, j, k, i - 1, j, k)) {
      block.setBlockBounds(0.0F, minSize, minSize, minSize, maxSize, maxSize);
      renderblocks.func_83018_a(block);
      renderblocks.renderStandardBlock(block, i, j, k);
    }

    if (Utils.checkLegacyPipesConnections(iblockaccess, i, j, k, i + 1, j, k)) {
      block.setBlockBounds(maxSize, minSize, minSize, 1.0F, maxSize, maxSize);
      renderblocks.func_83018_a(block);
      renderblocks.renderStandardBlock(block, i, j, k);
    }

    if (Utils.checkLegacyPipesConnections(iblockaccess, i, j, k, i, j - 1, k)) {
      block.setBlockBounds(minSize, 0.0F, minSize, maxSize, minSize, maxSize);
      renderblocks.func_83018_a(block);
      renderblocks.renderStandardBlock(block, i, j, k);
    }

    if (Utils.checkLegacyPipesConnections(iblockaccess, i, j, k, i, j + 1, k)) {
      block.setBlockBounds(minSize, maxSize, minSize, maxSize, 1.0F, maxSize);
      renderblocks.func_83018_a(block);
      renderblocks.renderStandardBlock(block, i, j, k);
    }

    if (Utils.checkLegacyPipesConnections(iblockaccess, i, j, k, i, j, k - 1)) {
      block.setBlockBounds(minSize, minSize, 0.0F, maxSize, maxSize, minSize);
      renderblocks.func_83018_a(block);
      renderblocks.renderStandardBlock(block, i, j, k);
    }

    if (Utils.checkLegacyPipesConnections(iblockaccess, i, j, k, i, j, k + 1)) {
      block.setBlockBounds(minSize, minSize, maxSize, maxSize, maxSize, 1.0F);
      renderblocks.func_83018_a(block);
      renderblocks.renderStandardBlock(block, i, j, k);
    }

    block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  }
Ejemplo n.º 19
0
 @Override
 public boolean renderWorldBlock(
     IBlockAccess w, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
   BlockMachine machine = (BlockMachine) block;
   int metadata = w.getBlockMetadata(x, y, z);
   Icon mside = IconRegistry.blockIcons.get(TextureReference.MACHINE_SIDE);
   Icon msidei = IconRegistry.blockIcons.get(TextureReference.MACHINE_SIDE_I);
   Icon mtop = IconRegistry.blockIcons.get(TextureReference.MACHINE_TOP);
   Icon mtopi = IconRegistry.blockIcons.get(TextureReference.MACHINE_TOP_I);
   Icon mbot = IconRegistry.blockIcons.get(TextureReference.MACHINE_BOTTOM);
   Icon mboti = IconRegistry.blockIcons.get(TextureReference.MACHINE_BOTTOM_I);
   Icon[] map = new Icon[6];
   FaceColor[] colors = machine.getTextureMap(w, x, y, z);
   colors[metadata] = FaceColor.VOID;
   for (int face = 0; face < 6; face++) {
     switch (face) {
       case 0:
         map[face] = colors[face].isColored() ? mboti : mbot;
         break;
       case 1:
         map[face] = colors[face].isColored() ? mtopi : mtop;
         break;
       default:
         map[face] = colors[face].isColored() ? msidei : mside;
         break;
     }
   }
   map[metadata] = machine.getFaceForMeta(metadata);
   machine.setOverride(map);
   renderer.renderStandardBlock(machine, x, y, z);
   for (int i = 0; i < 6; i++) {
     map[i] = IconRegistry.blockIcons.get(colors[i].getTexture());
   }
   renderer.renderStandardBlock(machine, x, y, z);
   machine.restoreTextures();
   return true;
 }
Ejemplo n.º 20
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int i, int j, int k, Block block, int modelId, RenderBlocks renderer) {
    IBlockAccess blockAccess = renderer.blockAccess;
    renderer.renderAllFaces = true;
    Block blockToRender = TFCBlocks.Planks;
    if (block instanceof IMultipleBlock) {
      blockToRender = ((IMultipleBlock) block).getBlockTypeForRender();
    }

    TEStand te = (TEStand) (world.getTileEntity(i, j, k));
    if ((world.getTileEntity(i, j - 1, k) != null
            && world.getTileEntity(i, j - 1, k) instanceof TEStand)
        || te.isTop) return false;
    int l = (int) (((te.yaw % 360) / 90) % 2);
    // Arms of the Stand
    if (l == 0) {
      renderer.setRenderBounds(0.1F, 1.35F, 0.44F, 0.9F, 1.45F, 0.56F);
      renderer.renderStandardBlock(blockToRender, i, j, k);

      // Main posts of the stand
      renderer.setRenderBounds(0.35F, 0.101F, 0.45F, 0.45F, 1.35F, 0.55F);
      renderer.renderStandardBlock(blockToRender, i, j, k);

      renderer.setRenderBounds(0.55F, 0.101F, 0.45F, 0.65F, 1.35F, 0.55F);
      renderer.renderStandardBlock(blockToRender, i, j, k);
    } else {
      renderer.setRenderBounds(0.44F, 1.35F, 0.1F, 0.56F, 1.45F, 0.9F);
      renderer.renderStandardBlock(blockToRender, i, j, k);

      // Main posts of the stand
      renderer.setRenderBounds(0.45F, 0.101F, 0.35F, 0.55F, 1.35F, 0.45F);
      renderer.renderStandardBlock(blockToRender, i, j, k);

      renderer.setRenderBounds(0.45F, 0.101F, 0.55F, 0.55F, 1.35F, 0.65F);
      renderer.renderStandardBlock(blockToRender, i, j, k);
    }

    // Base of the stand
    renderer.setRenderBounds(0.1F, 0F, 0.1F, 0.9F, 0.1F, 0.9F);
    renderer.renderStandardBlock(blockToRender, i, j, k);

    renderer.setRenderBounds(0.45F, 1.45F, 0.45F, 0.55F, 1.9F, 0.55F);
    renderer.renderStandardBlock(blockToRender, i, j, k);
    renderer.renderAllFaces = false;
    return true;
  }
Ejemplo n.º 21
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    int meta = world.getBlockMetadata(x, y, z);

    renderer.renderStandardBlock(block, x, y, z);

    Tessellator tessellator = Tessellator.instance;
    IIcon icon = ChiselBlocks.blockSpiketrap.iconSpike;
    //		Icon icon=Chisel.blockSpiketrap.iconBase;

    double h = 0.85;
    double d = 1.5 / 16;
    double r = d / 2;

    double tx = x + 0.25;
    double ty = y + h;
    double tz = z + 0.25;
    double skew = 0.5;

    //       tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
    tessellator.addTranslation(0, 1.0f / 16, 0);

    Random rand = new Random();
    for (int xx = 0; xx < 4; xx++) {
      for (int yy = 0; yy < 4; yy++) {
        //				float sx=1.0f/16+rand.nextFloat()*13.0f/16;
        //				float sz=1.0f/16+rand.nextFloat()*13.0f/16;
        float sx = (2.0f + (12.0f - (float) d) * xx / 3) / 16;
        float sz = (2.0f + (12.0f - (float) d) * yy / 3) / 16;

        tessellator.addTranslation(sx, 0, sz);
        drawSpike(
            icon,
            r,
            0.5 + rand.nextDouble() * 0.35,
            x,
            y,
            z,
            rand.nextDouble() * skew - skew / 2,
            rand.nextDouble() * skew - skew / 2);
        tessellator.addTranslation(-sx, 0, -sz);
      }
    }

    tessellator.addTranslation(0, -1.0f / 16, 0);

    return true;
  }
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    int metadata = world.getBlockMetadata(x, y, z);

    if (MachineType.get(block.blockID, metadata) != null) {
      if (!MachineType.get(block.blockID, metadata).hasModel) {
        renderer.renderStandardBlock(block, x, y, z);
        renderer.setRenderBoundsFromBlock(block);
        return true;
      }
    }

    return false;
  }
  private boolean renderWorldBlock(
      IBlockAccess world,
      int x,
      int y,
      int z,
      BlockThinLogFence block,
      int modelId,
      RenderBlocks renderer) {
    float margin = block.getMargin();

    renderer.setRenderBounds(margin, 0, margin, 1 - margin, 1, 1 - margin);
    renderer.renderStandardBlock(block, x, y, z);

    IIcon sideIcon = block.getSideIcon();

    boolean connectedZNeg = block.canConnectFenceTo(world, x, y, z - 1);
    boolean connectedZPos = block.canConnectFenceTo(world, x, y, z + 1);
    boolean connectedXNeg = block.canConnectFenceTo(world, x - 1, y, z);
    boolean connectedXPos = block.canConnectFenceTo(world, x + 1, y, z);

    if (connectedXNeg || connectedXPos) {
      if (connectedXNeg && connectedXPos) renderer.setRenderBounds(0, 0, .5, 1, 1, .5);
      else if (connectedXNeg) renderer.setRenderBounds(0, 0, .5, .5, 1, .5);
      else if (connectedXPos) renderer.setRenderBounds(.5, 0, .5, 1, 1, .5);

      renderer.flipTexture = true;
      renderer.renderFaceZNeg(block, x, y, z, sideIcon);
      renderer.flipTexture = false;
      renderer.renderFaceZPos(block, x, y, z, sideIcon);
    }

    if (connectedZNeg || connectedZPos) {
      if (connectedZNeg && connectedZPos) renderer.setRenderBounds(.5, 0, 0, .5, 1, 1);
      else if (connectedZNeg) renderer.setRenderBounds(.5, 0, 0, .5, 1, .5f);
      else if (connectedZPos) renderer.setRenderBounds(.5, 0, .5f, .5, 1, 1);

      renderer.flipTexture = true;
      renderer.renderFaceXPos(block, x, y, z, sideIcon);
      renderer.flipTexture = false;
      renderer.renderFaceXNeg(block, x, y, z, sideIcon);
    }

    return true;
  }
Ejemplo n.º 24
0
  private void pipeGateRender(
      RenderBlocks renderblocks, Block block, PipeRenderState state, int x, int y, int z) {

    state.currentTexture =
        BuildCraftTransport.instance.gateIconProvider.getIcon(state.getGateIconIndex());

    float min = Utils.pipeMinPos + 0.05F;
    float max = Utils.pipeMaxPos - 0.05F;

    if (shouldRenderNormalPipeSide(state, ForgeDirection.WEST)) {
      block.setBlockBounds(Utils.pipeMinPos - 0.10F, min, min, Utils.pipeMinPos, max, max);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, x, y, z);
    }

    if (shouldRenderNormalPipeSide(state, ForgeDirection.EAST)) {
      block.setBlockBounds(Utils.pipeMaxPos, min, min, Utils.pipeMaxPos + 0.10F, max, max);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, x, y, z);
    }

    if (shouldRenderNormalPipeSide(state, ForgeDirection.DOWN)) {
      block.setBlockBounds(min, Utils.pipeMinPos - 0.10F, min, max, Utils.pipeMinPos, max);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, x, y, z);
    }

    if (shouldRenderNormalPipeSide(state, ForgeDirection.UP)) {
      block.setBlockBounds(min, Utils.pipeMaxPos, min, max, Utils.pipeMaxPos + 0.10F, max);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, x, y, z);
    }

    if (shouldRenderNormalPipeSide(state, ForgeDirection.NORTH)) {
      block.setBlockBounds(min, min, Utils.pipeMinPos - 0.10F, max, max, Utils.pipeMinPos);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, x, y, z);
    }

    if (shouldRenderNormalPipeSide(state, ForgeDirection.SOUTH)) {
      block.setBlockBounds(min, min, Utils.pipeMaxPos, max, max, Utils.pipeMaxPos + 0.10F);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, x, y, z);
    }
  }
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {

    int ID = block.blockID;
    int meta = world.getBlockMetadata(x, y, z);
    if (meta > 8) meta = 8;
    this.boxIcon = Block.planks.getIcon(0, 0);
    this.contentsIcon = DCsAppleMilk.bowlBlock.getIcon(0, meta);

    if (modelId == this.getRenderId()) {
      // box
      renderer.setOverrideBlockTexture(this.boxIcon);
      block.setBlockBounds(
          6.0F / 16.0F, 0.0F / 16.0F, 6.0F / 16.0F, 10.0F / 16.0F, 1.0F / 16.0F, 10.0F / 16.0F);
      renderer.setRenderBoundsFromBlock(block);
      renderer.renderStandardBlock(block, x, y, z);

      renderer.setOverrideBlockTexture(this.boxIcon);
      block.setBlockBounds(
          4.0F / 16.0F, 1.0F / 16.0F, 4.0F / 16.0F, 12.0F / 16.0F, 2.0F / 16.0F, 12.0F / 16.0F);
      renderer.setRenderBoundsFromBlock(block);
      renderer.renderStandardBlock(block, x, y, z);

      // contents
      if (meta == 0 || meta == 4) {
        renderer.setOverrideBlockTexture(this.contentsIcon);
        block.setBlockBounds(
            4.0F / 16.0F, 2.0F / 16.0F, 4.0F / 16.0F, 12.0F / 16.0F, 7.0F / 16.0F, 12.0F / 16.0F);
        renderer.setRenderBoundsFromBlock(block);
        renderer.renderStandardBlock(block, x, y, z);

        renderer.setOverrideBlockTexture(this.contentsIcon);
        block.setBlockBounds(
            5.0F / 16.0F, 7.0F / 16.0F, 5.0F / 16.0F, 11.0F / 16.0F, 8.0F / 16.0F, 11.0F / 16.0F);
        renderer.setRenderBoundsFromBlock(block);
        renderer.renderStandardBlock(block, x, y, z);
      } else if (meta < 8) {
        renderer.setOverrideBlockTexture(this.contentsIcon);
        block.setBlockBounds(
            4.0F / 16.0F, 2.0F / 16.0F, 4.0F / 16.0F, 12.0F / 16.0F, 4.0F / 16.0F, 12.0F / 16.0F);
        renderer.setRenderBoundsFromBlock(block);
        renderer.renderStandardBlock(block, x, y, z);
      }

      renderer.setOverrideBlockTexture(this.boxIcon);
      block.setBlockBounds(
          3.0F / 16.0F, 2.0F / 16.0F, 3.0F / 16.0F, 13.0F / 16.0F, 5.0F / 16.0F, 4.0F / 16.0F);
      renderer.setRenderBoundsFromBlock(block);
      renderer.renderStandardBlock(block, x, y, z);
      renderer.setOverrideBlockTexture(this.boxIcon);
      block.setBlockBounds(
          3.0F / 16.0F, 2.0F / 16.0F, 12.0F / 16.0F, 13.0F / 16.0F, 5.0F / 16.0F, 13.0F / 16.0F);
      renderer.setRenderBoundsFromBlock(block);
      renderer.renderStandardBlock(block, x, y, z);
      renderer.setOverrideBlockTexture(this.boxIcon);
      block.setBlockBounds(
          3.0F / 16.0F, 2.0F / 16.0F, 4.0F / 16.0F, 4.0F / 16.0F, 5.0F / 16.0F, 12.0F / 16.0F);
      renderer.setRenderBoundsFromBlock(block);
      renderer.renderStandardBlock(block, x, y, z);
      renderer.setOverrideBlockTexture(this.boxIcon);
      block.setBlockBounds(
          12.0F / 16.0F, 2.0F / 16.0F, 4.0F / 16.0F, 13.0F / 16.0F, 5.0F / 16.0F, 12.0F / 16.0F);
      renderer.setRenderBoundsFromBlock(block);
      renderer.renderStandardBlock(block, x, y, z);

      renderer.clearOverrideBlockTexture();
      block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
      renderer.setRenderBoundsFromBlock(block);
      return true;
    }
    return false;
  }
Ejemplo n.º 26
0
  public void renderPipe(
      RenderBlocks renderblocks,
      IBlockAccess iblockaccess,
      Block block,
      IPipeRenderState renderState,
      int x,
      int y,
      int z) {

    float minSize = Utils.pipeMinPos;
    float maxSize = Utils.pipeMaxPos;

    PipeRenderState state = renderState.getRenderState();
    IIconProvider icons = renderState.getPipeIcons();
    if (icons == null) return;

    state.currentTexture =
        icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.UNKNOWN));
    block.setBlockBounds(minSize, minSize, minSize, maxSize, maxSize, maxSize);
    renderblocks.setRenderBoundsFromBlock(block);
    renderblocks.renderStandardBlock(block, x, y, z);

    if (state.pipeConnectionMatrix.isConnected(ForgeDirection.WEST)) {
      state.currentTexture =
          icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.WEST));
      block.setBlockBounds(0.0F, minSize, minSize, minSize, maxSize, maxSize);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, x, y, z);
    }

    if (state.pipeConnectionMatrix.isConnected(ForgeDirection.EAST)) {
      state.currentTexture =
          icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.EAST));
      block.setBlockBounds(maxSize, minSize, minSize, 1.0F, maxSize, maxSize);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, x, y, z);
    }

    if (state.pipeConnectionMatrix.isConnected(ForgeDirection.DOWN)) {
      state.currentTexture =
          icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.DOWN));
      block.setBlockBounds(minSize, 0.0F, minSize, maxSize, minSize, maxSize);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, x, y, z);
    }

    if (state.pipeConnectionMatrix.isConnected(ForgeDirection.UP)) {
      state.currentTexture = icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.UP));
      block.setBlockBounds(minSize, maxSize, minSize, maxSize, 1.0F, maxSize);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, x, y, z);
    }

    if (state.pipeConnectionMatrix.isConnected(ForgeDirection.NORTH)) {
      state.currentTexture =
          icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.NORTH));
      block.setBlockBounds(minSize, minSize, 0.0F, maxSize, maxSize, minSize);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, x, y, z);
    }

    if (state.pipeConnectionMatrix.isConnected(ForgeDirection.SOUTH)) {
      state.currentTexture =
          icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.SOUTH));
      block.setBlockBounds(minSize, minSize, maxSize, maxSize, maxSize, 1.0F);
      renderblocks.setRenderBoundsFromBlock(block);
      renderblocks.renderStandardBlock(block, x, y, z);
    }

    block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);

    if (state.wireMatrix.hasWire(WireColor.Red)) {
      state.currentTexture =
          BuildCraftTransport.instance.wireIconProvider.getIcon(
              state.wireMatrix.getWireIconIndex(WireColor.Red));

      pipeWireRender(
          renderblocks,
          block,
          state,
          Utils.pipeMinPos,
          Utils.pipeMaxPos,
          Utils.pipeMinPos,
          IPipe.WireColor.Red,
          x,
          y,
          z);
    }

    if (state.wireMatrix.hasWire(WireColor.Blue)) {
      state.currentTexture =
          BuildCraftTransport.instance.wireIconProvider.getIcon(
              state.wireMatrix.getWireIconIndex(WireColor.Blue));
      pipeWireRender(
          renderblocks,
          block,
          state,
          Utils.pipeMaxPos,
          Utils.pipeMaxPos,
          Utils.pipeMaxPos,
          IPipe.WireColor.Blue,
          x,
          y,
          z);
    }

    if (state.wireMatrix.hasWire(WireColor.Green)) {
      state.currentTexture =
          BuildCraftTransport.instance.wireIconProvider.getIcon(
              state.wireMatrix.getWireIconIndex(WireColor.Green));
      pipeWireRender(
          renderblocks,
          block,
          state,
          Utils.pipeMaxPos,
          Utils.pipeMinPos,
          Utils.pipeMinPos,
          IPipe.WireColor.Green,
          x,
          y,
          z);
    }

    if (state.wireMatrix.hasWire(WireColor.Yellow)) {
      state.currentTexture =
          BuildCraftTransport.instance.wireIconProvider.getIcon(
              state.wireMatrix.getWireIconIndex(WireColor.Yellow));
      pipeWireRender(
          renderblocks,
          block,
          state,
          Utils.pipeMinPos,
          Utils.pipeMinPos,
          Utils.pipeMaxPos,
          IPipe.WireColor.Yellow,
          x,
          y,
          z);
    }

    if (state.hasGate()) {
      pipeGateRender(renderblocks, block, state, x, y, z);
    }

    pipeFacadeRenderer(renderblocks, block, state, x, y, z);
    pipePlugRenderer(renderblocks, block, state, x, y, z);
  }
  @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;
  }
Ejemplo n.º 28
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    TEBarrel te = (TEBarrel) world.getTileEntity(x, y, z);
    Block planksBlock;
    Block lidBlock;
    if (te.barrelType < 16) {
      planksBlock = TFCBlocks.Planks;
      lidBlock = TFCBlocks.WoodSupportH;
    } else {
      planksBlock = TFCBlocks.Planks2;
      lidBlock = TFCBlocks.WoodSupportH2;
    }
    renderer.renderAllFaces = true;

    if ((te.rotation & -128) == 0) {
      if (te.getSealed()) {
        renderer.setRenderBounds(min + 0.05F, min, min + 0.05F, max - 0.05F, 0.95F, max - 0.05F);
        renderer.renderStandardBlock(lidBlock, x, y, z);
      } else {
        renderer.setRenderBounds(
            min + 0.05F, min, min + 0.05F, max - 0.05F, min + 0.05F, max - 0.05F);
        renderer.renderStandardBlock(lidBlock, x, y, z);

        if (te.fluid != null) {
          int color = te.fluid.getFluid().getColor(te.fluid);
          float f = (color >> 16 & 255) / 255.0F;
          float f1 = (color >> 8 & 255) / 255.0F;
          float f2 = (color & 255) / 255.0F;
          float h = 0.75f * (te.fluid.amount / 10000f);
          renderer.setRenderBounds(
              min + 0.05F, min + 0.05, min + 0.05F, max - 0.05F, min + 0.05f + h, max - 0.05F);
          IIcon still = te.fluid.getFluid().getStillIcon();
          renderer.setOverrideBlockTexture(still);
          renderer.renderStandardBlockWithColorMultiplier(lidBlock, x, y, z, f, f1, f2);
          renderer.clearOverrideBlockTexture();
        }
      }
      renderer.setRenderBounds(min, 0F, min + 0.05F, min + 0.05F, 1F, max - 0.05F);
      rotate(renderer, 1);
      renderer.renderStandardBlock(planksBlock, x, y, z);
      rotate(renderer, 0);
      renderer.renderStandardBlock(block, x, y, z);

      renderer.setRenderBounds(max - 0.05F, 0F, min + 0.05F, max, 1F, max - 0.05F);
      rotate(renderer, 1);
      renderer.renderStandardBlock(planksBlock, x, y, z);
      rotate(renderer, 0);
      renderer.renderStandardBlock(block, x, y, z);

      renderer.setRenderBounds(min, 0F, min, max, 1F, min + 0.05F);
      rotate(renderer, 1);
      renderer.renderStandardBlock(planksBlock, x, y, z);
      rotate(renderer, 0);
      renderer.renderStandardBlock(block, x, y, z);

      renderer.setRenderBounds(min, 0F, max - 0.05F, max, 1F, max);
      rotate(renderer, 1);
      renderer.renderStandardBlock(planksBlock, x, y, z);
      rotate(renderer, 0);
      renderer.renderStandardBlock(block, x, y, z);
    } else {
      if ((te.rotation & 3) == 0) {
        renderer.setRenderBounds(min, min, min + 0.05F, 0.95F, min + 0.05F, max - 0.05F);
        renderer.renderStandardBlock(lidBlock, x, y, z);
      }
      if ((te.rotation & 3) == 1) {
        renderer.setRenderBounds(min + 0.05F, min, min, max - 0.05F, min + 0.05F, 0.95F);
        renderer.renderStandardBlock(lidBlock, x, y, z);
      }
    }

    renderer.renderAllFaces = false;

    return true;
  }
Ejemplo n.º 29
0
    @Override
    public void renderPluggable(
        RenderBlocks renderblocks,
        IPipe pipe,
        ForgeDirection side,
        PipePluggable pipePluggable,
        ITextureStates blockStateMachine,
        int renderPass,
        int x,
        int y,
        int z) {
      float[][] zeroState = new float[3][2];

      // X START - END
      zeroState[0][0] = 0.1875F;
      zeroState[0][1] = 0.8125F;
      // Y START - END
      zeroState[1][0] = 0.000F;
      zeroState[1][1] = 0.125F;
      // Z START - END
      zeroState[2][0] = 0.1875F;
      zeroState[2][1] = 0.8125F;

      if (renderPass == 1) {
        blockStateMachine.setRenderMask(1 << side.ordinal() | (1 << (side.ordinal() ^ 1)));

        for (int i = 0; i < 3; i++) {
          zeroState[i][0] += zFightOffset;
          zeroState[i][1] -= zFightOffset;
        }
        blockStateMachine
            .getTextureState()
            .set(
                BuildCraftTransport.instance.pipeIconProvider.getIcon(
                    PipeIconProvider.TYPE.PipeLensOverlay.ordinal()));
        ((FakeBlock) blockStateMachine)
            .setColor(ColorUtils.getRGBColor(15 - ((LensPluggable) pipePluggable).color));

        blockStateMachine.setRenderAllSides();
      } else {
        if (((LensPluggable) pipePluggable).isFilter) {
          blockStateMachine
              .getTextureState()
              .set(
                  BuildCraftTransport.instance.pipeIconProvider.getIcon(
                      PipeIconProvider.TYPE.PipeFilter.ordinal()));
        } else {
          blockStateMachine
              .getTextureState()
              .set(
                  BuildCraftTransport.instance.pipeIconProvider.getIcon(
                      PipeIconProvider.TYPE.PipeLens.ordinal()));
        }
      }

      float[][] rotated = MatrixTranformations.deepClone(zeroState);
      MatrixTranformations.transform(rotated, side);

      renderblocks.setRenderBounds(
          rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]);
      renderblocks.renderStandardBlock(blockStateMachine.getBlock(), x, y, z);

      ((FakeBlock) blockStateMachine).setColor(0xFFFFFF);
    }
Ejemplo n.º 30
0
  @Override
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {

    IIcon soulariumIcon = EnderIO.blockSoulFuser.getIcon(ForgeDirection.EAST.ordinal(), 0);
    override = renderer.overrideBlockTexture;

    // Horrible hack to get the MC lighting engine to set the correct values for me
    if (renderer != null && world != null) {
      renderer.setOverrideBlockTexture(IconUtil.blankTexture);
      renderer.renderStandardBlock(Blocks.stone, x, y, z);
      renderer.setOverrideBlockTexture(null);
    }
    BoundingBox bb;

    Tessellator.instance.addTranslation(x, y, z);

    bb = BoundingBox.UNIT_CUBE.scale(0.85, 0.85, 0.85);
    setIcons(soulariumIcon, soulariumIcon, ForgeDirection.NORTH);
    CubeRenderer.render(bb, icons, true);

    float slabWidth = 0.15f;
    bb = BoundingBox.UNIT_CUBE.scale(1, slabWidth, 1);
    bb = bb.translate(0, 0.5f - (slabWidth / 2), 0);
    setIcons(
        soulariumIcon,
        EnderIO.blockSoulFuser.getIcon(ForgeDirection.UP.ordinal(), 0),
        ForgeDirection.UP);
    CubeRenderer.render(bb, icons, true);

    bb = BoundingBox.UNIT_CUBE.scale(1, slabWidth, 1);
    bb = bb.translate(0, -0.5f + (slabWidth / 2), 0);
    setIcons(soulariumIcon, soulariumIcon, ForgeDirection.NORTH);

    CubeRenderer.render(bb, icons, true);

    IIcon endermanIcon;
    int facing = ForgeDirection.SOUTH.ordinal();

    if (world == null || !(world.getTileEntity(x, y, z) instanceof TileSoulBinder)) {
      endermanIcon = EnderIO.blockSoulFuser.endermanSkullIcon;
    } else {
      TileSoulBinder sb = (TileSoulBinder) world.getTileEntity(x, y, z);
      facing = sb.facing;
      endermanIcon =
          sb.isActive()
              ? EnderIO.blockSoulFuser.endermanSkullIconOn
              : EnderIO.blockSoulFuser.endermanSkullIcon;
    }

    renderSkull(forFacing(ForgeDirection.SOUTH, facing), soulariumIcon, endermanIcon);
    renderSkull(
        forFacing(ForgeDirection.WEST, facing),
        soulariumIcon,
        EnderIO.blockSoulFuser.skeletonSkullIcon);
    renderSkull(
        forFacing(ForgeDirection.NORTH, facing),
        soulariumIcon,
        EnderIO.blockSoulFuser.zombieSkullIcon);
    renderSkull(
        forFacing(ForgeDirection.EAST, facing),
        soulariumIcon,
        EnderIO.blockSoulFuser.creeperSkullIcon);

    Tessellator.instance.addTranslation(-x, -y, -z);

    return true;
  }