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); }
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; }
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); }
public void rotate(RenderBlocks renderer, int i) { renderer.uvRotateEast = i; renderer.uvRotateWest = i; renderer.uvRotateNorth = i; renderer.uvRotateSouth = i; }
private void pipeFacadeRenderer( RenderBlocks renderblocks, Block block, PipeRenderState state, int x, int y, int z) { float zFightOffset = 1F / 4096F; float[][] zeroState = new float[3][2]; // X START - END zeroState[0][0] = 0.0F - zFightOffset / 2; zeroState[0][1] = 1.0F + zFightOffset / 2; // Y START - END zeroState[1][0] = 0.0F - zFightOffset; zeroState[1][1] = facadeThickness; // Z START - END zeroState[2][0] = 0.0F; zeroState[2][1] = 1.0F; for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { if (state.facadeMatrix.getFacadeBlockId(direction) != 0) { Block renderBlock = Block.blocksList[state.facadeMatrix.getFacadeBlockId(direction)]; int renderMeta = state.facadeMatrix.getFacadeMetaId(direction); state.currentTexture = renderBlock.getIcon(direction.ordinal(), renderMeta); if (renderBlock.getRenderType() == 31) { if ((renderMeta & 12) == 4) { renderblocks.uvRotateEast = 1; renderblocks.uvRotateWest = 1; renderblocks.uvRotateTop = 1; renderblocks.uvRotateBottom = 1; } else if ((renderMeta & 12) == 8) { renderblocks.uvRotateSouth = 1; renderblocks.uvRotateNorth = 1; } } // Hollow facade if (state.pipeConnectionMatrix.isConnected(direction)) { float[][] rotated = deepClone(zeroState); rotated[2][0] = 0.0F; rotated[2][1] = Utils.pipeMinPos; rotated[1][0] -= zFightOffset / 2; transform(rotated, direction); block.setBlockBounds( rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); rotated = deepClone(zeroState); rotated[2][0] = Utils.pipeMaxPos; rotated[1][0] -= zFightOffset / 2; transform(rotated, direction); block.setBlockBounds( rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); rotated = deepClone(zeroState); rotated[0][0] = 0.0F; rotated[0][1] = Utils.pipeMinPos; rotated[1][1] -= zFightOffset; transform(rotated, direction); block.setBlockBounds( rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); rotated = deepClone(zeroState); rotated[0][0] = Utils.pipeMaxPos; rotated[0][1] = 1F; rotated[1][1] -= zFightOffset; transform(rotated, direction); block.setBlockBounds( rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); } else { // Solid facade float[][] rotated = deepClone(zeroState); transform(rotated, direction); block.setBlockBounds( rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); } if (renderBlock.getRenderType() == 31) { renderblocks.uvRotateSouth = 0; renderblocks.uvRotateEast = 0; renderblocks.uvRotateWest = 0; renderblocks.uvRotateNorth = 0; renderblocks.uvRotateTop = 0; renderblocks.uvRotateBottom = 0; } } } // X START - END zeroState[0][0] = Utils.pipeMinPos; zeroState[0][1] = Utils.pipeMaxPos; // Y START - END zeroState[1][0] = facadeThickness; zeroState[1][1] = Utils.pipeMinPos; // Z START - END zeroState[2][0] = Utils.pipeMinPos; zeroState[2][1] = Utils.pipeMaxPos; state.currentTexture = BuildCraftTransport.instance.pipeIconProvider.getIcon( PipeIconProvider.PipeStructureCobblestone); // Structure Pipe for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { if (state.facadeMatrix.getFacadeBlockId(direction) != 0 && !state.pipeConnectionMatrix.isConnected(direction)) { float[][] rotated = deepClone(zeroState); transform(rotated, direction); block.setBlockBounds( rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1], rotated[2][1]); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); } } }
@Override public boolean renderWorldBlock( IBlockAccess iblockaccess, int x, int y, int z, Block block, int l, RenderBlocks renderblocks) { int meta = iblockaccess.getBlockMetadata(x, y, z); if (meta == ForgeDirection.EAST.ordinal()) { renderblocks.uvRotateEast = 2; renderblocks.uvRotateWest = 1; renderblocks.uvRotateTop = 1; renderblocks.uvRotateBottom = 2; block.setBlockBounds(0.0F, 0.0F, 0.0F, 4F / 16F, 1, 1); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); block.setBlockBounds(4F / 16F, 5F / 16F, 5F / 16F, 13F / 16F, 11F / 16F, 11F / 16F); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); } else if (meta == ForgeDirection.WEST.ordinal()) { renderblocks.uvRotateEast = 1; renderblocks.uvRotateWest = 2; renderblocks.uvRotateTop = 2; renderblocks.uvRotateBottom = 1; block.setBlockBounds(1F - 4F / 16F, 0.0F, 0.0F, 1, 1, 1); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); block.setBlockBounds(1F - 13F / 16F, 5F / 16F, 5F / 16F, 1F - 4F / 16F, 11F / 16F, 11F / 16F); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); } else if (meta == ForgeDirection.NORTH.ordinal()) { renderblocks.uvRotateSouth = 1; renderblocks.uvRotateNorth = 2; block.setBlockBounds(0.0F, 0.0F, 1F - 4F / 16F, 1, 1, 1); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); block.setBlockBounds(5F / 16F, 5F / 16F, 1F - 13F / 16F, 11F / 16F, 11F / 16F, 1F - 4F / 16F); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); } else if (meta == ForgeDirection.SOUTH.ordinal()) { renderblocks.uvRotateSouth = 2; renderblocks.uvRotateNorth = 1; renderblocks.uvRotateTop = 3; renderblocks.uvRotateBottom = 3; block.setBlockBounds(0.0F, 0.0F, 0.0F, 1, 1, 4F / 16F); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); block.setBlockBounds(5F / 16F, 5F / 16F, 4F / 16F, 11F / 16F, 11F / 16F, 13F / 16F); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); } else if (meta == ForgeDirection.DOWN.ordinal()) { renderblocks.uvRotateEast = 3; renderblocks.uvRotateWest = 3; renderblocks.uvRotateSouth = 3; renderblocks.uvRotateNorth = 3; block.setBlockBounds(0.0F, 1.0F - 4F / 16F, 0.0F, 1.0F, 1.0F, 1.0F); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); block.setBlockBounds(5F / 16F, 1F - 13F / 16F, 5F / 16F, 11F / 16F, 1F - 4F / 16F, 11F / 16F); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); } else if (meta == ForgeDirection.UP.ordinal()) { block.setBlockBounds(0.0F, 0.0F, 0.0F, 1, 4F / 16F, 1); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); block.setBlockBounds(5F / 16F, 4F / 16F, 5F / 16F, 11F / 16F, 13F / 16F, 11F / 16F); renderblocks.setRenderBoundsFromBlock(block); renderblocks.renderStandardBlock(block, x, y, z); } block.setBlockBounds(0.0F, 0.0F, 0.0F, 1, 1, 1); renderblocks.uvRotateEast = 0; renderblocks.uvRotateWest = 0; renderblocks.uvRotateSouth = 0; renderblocks.uvRotateNorth = 0; renderblocks.uvRotateTop = 0; renderblocks.uvRotateBottom = 0; return true; }