Package buildcraft.api.core

Examples of buildcraft.api.core.IIconProvider


  public static int renderPass = -1
  public static float zFightOffset = 1F / 4096F;
 
  public void renderPipe(RenderBlocks renderblocks, IBlockAccess iblockaccess, TileGenericPipe tile, int x, int y, int z) {
    PipeRenderState state = tile.renderState;
    IIconProvider icons = tile.getPipeIcons();
    FakeBlock fakeBlock = FakeBlock.INSTANCE;
    int glassColorMultiplier = tile.getStainedColorMultiplier();
   
    if (icons == null) {
      return;
   

    if (renderPass == 0 || glassColorMultiplier >= 0) {
      // Pass 0 handles the pipe texture, pass 1 handles the transparent stained glass
      int connectivity = state.pipeConnectionMatrix.getMask();
      float[] dim = new float[6];
     
      if (renderPass == 1) {
        fakeBlock.setColor(glassColorMultiplier);
      }
 
      // render the unconnected pipe faces of the center block (if any)
 
      if (connectivity != 0x3f) { // note: 0x3f = 0x111111 = all sides
        resetToCenterDimensions(dim);
       
        if (renderPass == 0) {
          fakeBlock.getTextureState().set(icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.UNKNOWN)));
        } else {
          fakeBlock.getTextureState().set(PipeIconProvider.TYPE.PipeStainedOverlay.getIcon());
        }
       
        fixForRenderPass(dim);
       
        renderTwoWayBlock(renderblocks, fakeBlock, x, y, z, dim, connectivity ^ 0x3f);
      }
 
      // render the connecting pipe faces
      for (int dir = 0; dir < 6; dir++) {
        int mask = 1 << dir;
 
        if ((connectivity & mask) == 0) {
          continue; // no connection towards dir
        }
 
        // center piece offsets
        resetToCenterDimensions(dim);
 
        // extend block towards dir as it's connected to there
        dim[dir / 2] = dir % 2 == 0 ? 0 : CoreConstants.PIPE_MAX_POS;
        dim[dir / 2 + 3] = dir % 2 == 0 ? CoreConstants.PIPE_MIN_POS : 1;
 
        // the mask points to all faces perpendicular to dir, i.e. dirs 0+1 -> mask 111100, 1+2 -> 110011, 3+5 -> 001111
        int renderMask = (3 << (dir / 2 * 2)) ^ 0x3f;
 
        fixForRenderPass(dim);
       
        // render sub block
        if (renderPass == 0) {
          fakeBlock.getTextureState().set(icons.getIcon(state.textureMatrix.getTextureIndex(ForgeDirection.VALID_DIRECTIONS[dir])));
        } else {
          fakeBlock.getTextureState().set(PipeIconProvider.TYPE.PipeStainedOverlay.getIcon());
        }
       
        renderTwoWayBlock(renderblocks, fakeBlock, x, y, z, dim, renderMask);
View Full Code Here

TOP

Related Classes of buildcraft.api.core.IIconProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.