@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; }
@Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { Block blockToRender = metadata < 16 ? TFCBlocks.Planks : TFCBlocks.Planks2; Block woodblock = metadata < 16 ? TFCBlocks.WoodSupportH : TFCBlocks.WoodSupportH2; if (block instanceof IMultipleBlock) blockToRender = ((IMultipleBlock) block).getBlockTypeForRender(); // Arms of the Stand renderer.setRenderBounds(0.44F, 1.45F * 0.70F, 0.2F, 0.56F, 1.55F * 0.70F, 0.8F); renderInvBlock(woodblock, metadata, renderer); renderer.setRenderBounds(0.45F, 0.201F * 0.70F, 0.35F, 0.55F, 1.45F * 0.70F, 0.45F); renderInvBlock(woodblock, metadata, renderer); renderer.setRenderBounds(0.45F, 0.201F * 0.70F, 0.55F, 0.55F, 1.45F * 0.70F, 0.65F); renderInvBlock(woodblock, metadata, renderer); // Base of the stand renderer.setRenderBounds(0.2F, 0F, 0.2F, 0.8F, 0.2F * 0.50F, 0.8F); renderInvBlock(blockToRender, metadata, renderer); // Main post of the stand renderer.setRenderBounds(0.45F, 1.45F * 0.70F, 0.45F, 0.55F, 1.9F * 0.70F, 0.55F); renderInvBlock(woodblock, metadata, renderer); }
@Override public void renderInventoryBlock( Block block, int metadata, int modelID, RenderBlocks renderBlocks) { renderBlocks.setRenderBounds(0.15D, 0.4D, 0.15D, 0.85D, 0.5D, 1.0D); super.renderInventoryBlock(block, metadata, modelID, renderBlocks); renderBlocks.setRenderBounds(0.2D, 0.0D, 0.2D, 0.8D, 0.4D, 0.3D); super.renderInventoryBlock(block, metadata, modelID, renderBlocks); }
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); }
@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; }
@Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { // Floor renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.6875D, 0.5D, 0.6875D); this.renderStandardBlock(block, metadata, renderer); // Channel Z- renderer.setRenderBounds(0.3125D, 0.375D, 0D, 0.6875D, 0.5D, 0.3125D); this.renderStandardBlock(block, metadata, renderer); renderer.setRenderBounds(0.3125D, 0.5D, 0D, 0.375D, 0.625D, 0.3125D); this.renderStandardBlock(block, metadata, renderer); renderer.setRenderBounds(0.625D, 0.5D, 0D, 0.6875D, 0.625D, 0.3125D); this.renderStandardBlock(block, metadata, renderer); // Channel Z+ renderer.setRenderBounds(0.3125D, 0.375D, 0.6875D, 0.6875D, 0.5D, 1D); this.renderStandardBlock(block, metadata, renderer); renderer.setRenderBounds(0.3125D, 0.5D, 0.6875D, 0.375D, 0.625D, 1D); this.renderStandardBlock(block, metadata, renderer); renderer.setRenderBounds(0.625D, 0.5D, 0.6875D, 0.6875D, 0.625D, 1D); this.renderStandardBlock(block, metadata, renderer); // Wall X- renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.375D, 0.625D, 0.6875D); this.renderStandardBlock(block, metadata, renderer); // Wall X+ renderer.setRenderBounds(0.625D, 0.375D, 0.3125D, 0.6875D, 0.625D, 0.6875D); this.renderStandardBlock(block, metadata, renderer); }
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 void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) { GL11.glTranslatef(-0.5F, -0.5F, -0.5F); GL11.glScalef(1.25f, 1.25f, 1.25f); renderer.setRenderBounds(0.0f, 0.0f, 0.5f - 0.0625f, 1.0f, 1.0f, 0.5f + 0.0625f); Drawing.drawBlock(block, meta, renderer); }
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(); } }
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 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; }
@Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { if (modelID == id) { final Tessellator tes = Tessellator.instance; final int offset = MathHelper.clamp_int(metadata, 0, 5) * 4; final BlockBeeBox beeBox = (BlockBeeBox) block; final IIcon[] icons = { beeBox.getIcon(0, metadata), beeBox.getIcon(1, metadata), beeBox.getIcon(2, metadata), beeBox.getIcon(3, metadata), beeBox.getIcon(4, metadata), beeBox.getIcon(5, metadata) }; final double d = 0.0625D; // LEGS renderer.setRenderBounds(3 * d, 0.0D, 3 * d, 5 * d, 3 * d, 5 * d); RenderUtils.renderInventoryBlockOverride(block, renderer, icons, tes); renderer.setRenderBounds(11 * d, 0.0D, 3 * d, 13 * d, 3 * d, 5 * d); RenderUtils.renderInventoryBlockOverride(block, renderer, icons, tes); renderer.setRenderBounds(3 * d, 0.0D, 11 * d, 5 * d, 3 * d, 13 * d); RenderUtils.renderInventoryBlockOverride(block, renderer, icons, tes); renderer.setRenderBounds(11 * d, 0.0D, 11 * d, 13 * d, 3 * d, 13 * d); RenderUtils.renderInventoryBlockOverride(block, renderer, icons, tes); // BODY renderer.setRenderBounds(1 * d, 3 * d, 1 * d, 15 * d, 10 * d, 15 * d); RenderUtils.renderInventoryBlockOverride(block, renderer, icons, tes); // ROOF renderer.setRenderBounds(0.0D, 10 * d, 0.0D, 1.0D, 13 * d, 1.0D); RenderUtils.renderInventoryBlockOverride(block, renderer, icons, tes); renderer.setRenderBounds(2 * d, 13 * d, 2 * d, 14 * d, 1.0D, 14 * d); RenderUtils.renderInventoryBlockOverride(block, renderer, icons, tes); } }
@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; }
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; }
private void renderSideAtOrigin( BlockThinLogFence block, int metadata, RenderBlocks renderer, Tessellator tessellator, float xs, float xe) { tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); renderer.setRenderBounds(xs, 0, 0, xe, 1, 1); renderer.renderFaceZNeg(block, 0, 0, .5f, block.getSideIcon()); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.setRenderBounds(xs, 0, 0, xe, 1, 1); renderer.renderFaceZPos(block, 0, 0, -.5f, block.getSideIcon()); tessellator.draw(); }
@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 void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) { Block lidBlock; if (meta < 16) { lidBlock = TFCBlocks.WoodSupportH; } else { lidBlock = TFCBlocks.WoodSupportH2; } renderer.setRenderBounds(min + 0.05F, min, min + 0.05F, max - 0.05F, 0.95F, max - 0.05F); rotate(renderer, 1); renderInvBlock(lidBlock, meta, renderer); renderer.setRenderBounds(min, 0F, min + 0.05F, min + 0.05F, 1F, max - 0.05F); rotate(renderer, 1); renderInvBlock(block, meta, renderer); rotate(renderer, 0); renderInvBlockHoop(block, meta, renderer); renderer.setRenderBounds(max - 0.05F, 0F, min + 0.05F, max, 1F, max - 0.05F); rotate(renderer, 1); renderInvBlock(block, meta, renderer); rotate(renderer, 0); renderInvBlockHoop(block, meta, renderer); renderer.setRenderBounds(min, 0F, min, max, 1F, min + 0.05F); rotate(renderer, 1); renderInvBlock(block, meta, renderer); rotate(renderer, 0); renderInvBlockHoop(block, meta, renderer); renderer.setRenderBounds(min, 0F, max - 0.05F, max, 1F, max); rotate(renderer, 1); renderInvBlock(block, meta, renderer); rotate(renderer, 0); renderInvBlockHoop(block, meta, renderer); }
@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; }
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; }
@Override public void renderInventoryBlock( Block block, int metadata, int modelID, RenderBlocks renderBlocks) { Tessellator tessellator = Tessellator.instance; GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); renderBlocks.setRenderBounds(0, 0, 0, 1.0D, 1.0D, 1.0D); tessellator.startDrawing(TRIANGLES); tessellator.setNormal(0.0F, 0.0F, -1.0F); HelperOrthoWedge.renderFaceZNeg( renderBlocks, Slope.ID_WEDGE_POS_W, 0.0D, 0.0D, 0.0D, block.getIcon(2, EventHandler.BLOCKICON_BASE_ID)); tessellator.setNormal(0.0F, 0.0F, 1.0F); HelperOrthoWedge.renderFaceZPos( renderBlocks, Slope.ID_WEDGE_POS_W, 0.0D, 0.0D, 0.0D, block.getIcon(2, EventHandler.BLOCKICON_BASE_ID)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); RenderHelper.renderFaceYNeg( renderBlocks, 0.0D, 0.0D, 0.0D, block.getIcon(0, EventHandler.BLOCKICON_BASE_ID)); tessellator.setNormal(1.0F, 0.0F, 0.0F); RenderHelper.renderFaceXPos( renderBlocks, 0.0D, 0.0D, 0.0D, block.getIcon(2, EventHandler.BLOCKICON_BASE_ID)); tessellator.setNormal(0.0F, 1.0F, 0.0F); HelperOblWedge.renderSlopeXNeg( renderBlocks, Slope.ID_WEDGE_POS_W, 0.0D, 0.0D, 0.0D, block.getIcon(1, EventHandler.BLOCKICON_BASE_ID)); tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); }
public static void renderInvNormalBlock(RenderBlocks renderBlocks, Block par1Block, int var2) { renderBlocks.setRenderBounds(0.2F, 0.0F, 0.2F, 0.8F, 0.5F, 0.8F); GCMarsBlockRendererRock.renderStandardBlock(renderBlocks, par1Block, var2); renderBlocks.setRenderBounds(0.52F, 0.0F, 0.4F, 0.68F, 0.68F, 0.6F); GCMarsBlockRendererRock.renderStandardBlock(renderBlocks, par1Block, var2); renderBlocks.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.65F, 0.75F); GCMarsBlockRendererRock.renderStandardBlock(renderBlocks, par1Block, var2); renderBlocks.setRenderBounds(0.15F, 0.0F, 0.25F, 0.2F, 0.4F, 0.75F); GCMarsBlockRendererRock.renderStandardBlock(renderBlocks, par1Block, var2); renderBlocks.setRenderBounds(0.8F, 0.0F, 0.25F, 0.85F, 0.4F, 0.75F); GCMarsBlockRendererRock.renderStandardBlock(renderBlocks, par1Block, var2); renderBlocks.setRenderBounds(0.25F, 0.0F, 0.1F, 0.75F, 0.4F, 0.2F); GCMarsBlockRendererRock.renderStandardBlock(renderBlocks, par1Block, var2); renderBlocks.setRenderBounds(0.25F, 0.0F, 0.8F, 0.75F, 0.4F, 0.9F); GCMarsBlockRendererRock.renderStandardBlock(renderBlocks, par1Block, var2); renderBlocks.clearOverrideBlockTexture(); }
@Override public boolean renderWorldBlock( IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_fence) { renderer.setRenderBounds(.375, 0, .375, .625, 1, .625); renderer.renderStandardBlock(block, x, y, z); BlockMetalDecoration md = (BlockMetalDecoration) block; if (md.canConnectFenceTo(world, x + 1, y, z)) { renderer.setRenderBounds(.625, .375, .4375, 1, .5625, .5625); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(.625, .75, .4375, 1, .9375, .5625); renderer.renderStandardBlock(block, x, y, z); } if (md.canConnectFenceTo(world, x - 1, y, z)) { renderer.setRenderBounds(0, .375, .4375, .375, .5625, .5625); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0, .75, .4375, .375, .9375, .5625); renderer.renderStandardBlock(block, x, y, z); } if (md.canConnectFenceTo(world, x, y, z + 1)) { renderer.setRenderBounds(.4375, .375, .625, .5625, .5625, 1); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(.4375, .75, .625, .5625, .9375, 1); renderer.renderStandardBlock(block, x, y, z); } if (md.canConnectFenceTo(world, x, y, z - 1)) { renderer.setRenderBounds(.4375, .375, 0, .5625, .5625, .375); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(.4375, .75, 0, .5625, .9375, .375); renderer.renderStandardBlock(block, x, y, z); } return true; } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_scaffolding) { renderer.setRenderBoundsFromBlock(block); float f = .015625f; float f1 = 0; renderer.renderFromInside = true; renderer.renderMinX += block.shouldSideBeRendered(world, x - 1, y, z, 4) ? f : f1; renderer.renderMinY += block.shouldSideBeRendered(world, x, y - 1, z, 0) ? f : f1; renderer.renderMinZ += block.shouldSideBeRendered(world, x, y, z - 1, 2) ? f : f1; renderer.renderMaxX -= block.shouldSideBeRendered(world, x + 1, y, z, 5) ? f : f1; renderer.renderMaxY -= block.shouldSideBeRendered(world, x, y + 1, z, 1) ? f : f1; renderer.renderMaxZ -= block.shouldSideBeRendered(world, x, y, z + 1, 3) ? f : f1; renderer.renderStandardBlock(block, x, y, z); renderer.renderMinX -= block.shouldSideBeRendered(world, x - 1, y, z, 4) ? f : f1; renderer.renderMinY -= block.shouldSideBeRendered(world, x, y - 1, z, 0) ? f : f1; renderer.renderMinZ -= block.shouldSideBeRendered(world, x, y, z - 1, 2) ? f : f1; renderer.renderMaxX += block.shouldSideBeRendered(world, x + 1, y, z, 5) ? f : f1; renderer.renderMaxY += block.shouldSideBeRendered(world, x, y + 1, z, 1) ? f : f1; renderer.renderMaxZ += block.shouldSideBeRendered(world, x, y, z + 1, 3) ? f : f1; renderer.renderFromInside = false; return renderer.renderStandardBlock(block, x, y, z); } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_lantern) // { // if(world.isAirBlock(x,y-1,z)&&!world.isAirBlock(x,y+1,z)) // { // renderer.uvRotateWest = 3; // renderer.uvRotateEast = 3; // renderer.uvRotateNorth = 3; // renderer.uvRotateSouth = 3; // renderer.setRenderBounds(.3125f,.875f,.3125f, .6875f,1,.6875f); // renderer.renderStandardBlock(block, x, y, z); // renderer.setRenderBounds(.25f,.1875f,.25f, .75f,.875f,.75f); // renderer.renderStandardBlock(block, x, y, z); // renderer.uvRotateWest = 0; // renderer.uvRotateEast = 0; // renderer.uvRotateNorth = 0; // renderer.uvRotateSouth = 0; // } // else // { // renderer.setRenderBounds(.3125f,0,.3125f, .6875f,.125f,.6875f); // renderer.renderStandardBlock(block, x, y, z); // renderer.setRenderBounds(.25f,.125f,.25f, .75f,.8125f,.75f); // renderer.renderStandardBlock(block, x, y, z); // } // return true; // } { TileEntityLantern tile = (TileEntityLantern) world.getTileEntity(x, y, z); ClientUtils.handleStaticTileRenderer(tile); return true; } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_structuralArm) { Tessellator tes = ClientUtils.tes(); IIcon iSide = block.getIcon(2, 3); IIcon iTop = block.getIcon(0, 3); int f = (world.getTileEntity(x, y, z) instanceof TileEntityStructuralArm) ? ((TileEntityStructuralArm) world.getTileEntity(x, y, z)).facing : 0; boolean inv = (world.getTileEntity(x, y, z) instanceof TileEntityStructuralArm) ? ((TileEntityStructuralArm) world.getTileEntity(x, y, z)).inverted : false; ForgeDirection fd = ForgeDirection.getOrientation(f); int rowTop = 0; while (rowTop < 8) { if (world.getTileEntity(x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1)) instanceof TileEntityStructuralArm && ((TileEntityStructuralArm) world.getTileEntity( x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1))) .facing == f && ((TileEntityStructuralArm) world.getTileEntity( x - fd.offsetX * (rowTop + 1), y, z - fd.offsetZ * (rowTop + 1))) .inverted == inv) rowTop++; else break; } int rowBot = 0; while (rowBot < 8) { if (world.getTileEntity(x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1)) instanceof TileEntityStructuralArm && ((TileEntityStructuralArm) world.getTileEntity( x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1))) .facing == f && ((TileEntityStructuralArm) world.getTileEntity( x + fd.offsetX * (rowBot + 1), y, z + fd.offsetZ * (rowBot + 1))) .inverted == inv) rowBot++; else break; } double rowTotal = rowTop + rowBot + 1; double yTop = 1 - rowTop / rowTotal; double yBot = rowBot / rowTotal; double d3 = iTop.getInterpolatedU(0); double d4 = iTop.getInterpolatedU(16); double d5 = iTop.getInterpolatedV(0); double d6 = iTop.getInterpolatedV(16); double d7 = d4; double d8 = d3; double d9 = d5; double d10 = d6; double y11 = f == 5 || f == 3 ? yBot : yTop; double y10 = f == 5 || f == 2 ? yBot : yTop; double y00 = f == 4 || f == 2 ? yBot : yTop; double y01 = f == 4 || f == 3 ? yBot : yTop; // SIDE 0 ClientUtils.BlockLightingInfo info = ClientUtils.calculateBlockLighting(0, world, block, x, y, z, 1, 1, 1); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV(x + 0, y + (inv ? 1 - y01 : 0), z + 1, d8, d10); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV(x + 0, y + (inv ? 1 - y00 : 0), z + 0, d3, d5); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 1, y + (inv ? 1 - y10 : 0), z + 0, d7, d9); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV(x + 1, y + (inv ? 1 - y11 : 0), z + 1, d4, d6); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV(x + 0, y + (inv ? 1 - y00 : 0) + .0001, z + 0, d3, d5); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV(x + 0, y + (inv ? 1 - y01 : 0) + .0001, z + 1, d8, d10); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV(x + 1, y + (inv ? 1 - y11 : 0) + .0001, z + 1, d4, d6); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 1, y + (inv ? 1 - y10 : 0) + .0001, z + 0, d7, d9); // SIDE 1 info = ClientUtils.calculateBlockLighting(1, world, block, x, y, z, 1, 1, 1); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV(x + 1, y + (inv ? 1 : y11), z + 1, d4, d6); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV(x + 1, y + (inv ? 1 : y10), z + 0, d7, d9); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : y00), z + 0, d3, d5); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : y01), z + 1, d8, d10); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV(x + 1, y + (inv ? 1 : y10) - .0001, z + 0, d7, d9); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV(x + 1, y + (inv ? 1 : y11) - .0001, z + 1, d4, d6); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : y01) - .0001, z + 1, d8, d10); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : y00) - .0001, z + 0, d3, d5); // SIDE 2 info = ClientUtils.calculateBlockLighting(2, world, block, x, y, z, 1, 1, 1); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 - y00 : y00), z + 0, iSide.getMinU(), iSide.getInterpolatedV(y00 * 16)); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV( x + 1, y + (inv ? 1 - y10 : y10), z + 0, iSide.getMaxU(), iSide.getInterpolatedV(y10 * 16)); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 0, iSide.getMaxU(), iSide.getMinV()); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV( x + 1, y + (inv ? 1 - y10 : y10), z + 0 + .0001, iSide.getMaxU(), iSide.getInterpolatedV(y10 * 16)); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 - y00 : y00), z + 0 + .0001, iSide.getMinU(), iSide.getInterpolatedV(y00 * 16)); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV( x + 0, y + (inv ? 1 : 0), z + 0 + .0001, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV( x + 1, y + (inv ? 1 : 0), z + 0 + .0001, iSide.getMaxU(), iSide.getMinV()); // SIDE 3 info = ClientUtils.calculateBlockLighting(3, world, block, x, y, z, 1, 1, 1); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 - y01 : y01), z + 1, iSide.getMinU(), iSide.getInterpolatedV(y01 * 16)); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 1, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV()); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV( x + 1, y + (inv ? 1 - y11 : y11), z + 1, iSide.getMaxU(), iSide.getInterpolatedV(y11 * 16)); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 : 0), z + 1 - .0001, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 - y01 : y01), z + 1 - .0001, iSide.getMinU(), iSide.getInterpolatedV(y01 * 16)); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV( x + 1, y + (inv ? 1 - y11 : y11), z + 1 - .0001, iSide.getMaxU(), iSide.getInterpolatedV(y11 * 16)); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV( x + 1, y + (inv ? 1 : 0), z + 1 - .0001, iSide.getMaxU(), iSide.getMinV()); // SIDE 4 info = ClientUtils.calculateBlockLighting(4, world, block, x, y, z, 1, 1, 1); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 - y01 : y01), z + 1, iSide.getMaxU(), iSide.getInterpolatedV(y01 * 16)); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV( x + 0, y + (inv ? 1 - y00 : y00), z + 0, iSide.getMinU(), iSide.getInterpolatedV(y00 * 16)); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV(x + 0, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV( x + 0 + .0001, y + (inv ? 1 - y00 : y00), z + 0, iSide.getMinU(), iSide.getInterpolatedV(y00 * 16)); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 0 + .0001, y + (inv ? 1 - y01 : y01), z + 1, iSide.getMaxU(), iSide.getInterpolatedV(y01 * 16)); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV( x + 0 + .0001, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV( x + 0 + .0001, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV()); // SIDE 5 info = ClientUtils.calculateBlockLighting(5, world, block, x, y, z, 1, 1, 1); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV(x + 1, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV( x + 1, y + (inv ? 1 - y10 : y10), z + 0, iSide.getMinU(), iSide.getInterpolatedV(y10 * 16)); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV( x + 1, y + (inv ? 1 - y11 : y11), z + 1, iSide.getMaxU(), iSide.getInterpolatedV(y11 * 16)); tes.setColorOpaque_F( info.colorRedBottomLeft, info.colorGreenBottomLeft, info.colorBlueBottomLeft); tes.setBrightness(info.brightnessBottomLeft); tes.addVertexWithUV( x + 1 - .0001, y + (inv ? 1 : 0), z + 0, iSide.getMinU(), iSide.getMinV()); tes.setColorOpaque_F(info.colorRedTopLeft, info.colorGreenTopLeft, info.colorBlueTopLeft); tes.setBrightness(info.brightnessTopLeft); tes.addVertexWithUV( x + 1 - .0001, y + (inv ? 1 : 0), z + 1, iSide.getMaxU(), iSide.getMinV()); tes.setColorOpaque_F(info.colorRedTopRight, info.colorGreenTopRight, info.colorBlueTopRight); tes.setBrightness(info.brightnessTopRight); tes.addVertexWithUV( x + 1 - .0001, y + (inv ? 1 - y11 : y11), z + 1, iSide.getMaxU(), iSide.getInterpolatedV(y11 * 16)); tes.setColorOpaque_F( info.colorRedBottomRight, info.colorGreenBottomRight, info.colorBlueBottomRight); tes.setBrightness(info.brightnessBottomRight); tes.addVertexWithUV( x + 1 - .0001, y + (inv ? 1 - y10 : y10), z + 0, iSide.getMinU(), iSide.getInterpolatedV(y10 * 16)); return true; } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_connectorStructural) { TileEntityConnectorStructural tile = (TileEntityConnectorStructural) world.getTileEntity(x, y, z); ClientUtils.handleStaticTileRenderer(tile); return true; } else if (world.getBlockMetadata(x, y, z) == BlockMetalDecoration.META_wallMount) { TileEntityWallmountMetal tile = (TileEntityWallmountMetal) world.getTileEntity(x, y, z); ClientUtils.handleStaticTileRenderer(tile); return true; } else { renderer.setRenderBounds(0, 0, 0, 1, 1, 1); return renderer.renderStandardBlock(block, x, y, z); } }
@Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { GL11.glPushMatrix(); try { if (metadata == BlockMetalDecoration.META_fence) { GL11.glTranslatef(-.5f, -.5f, -.5f); renderer.setRenderBounds(0, 0, .375, .25, 1, .625); ClientUtils.drawInventoryBlock(block, metadata, renderer); renderer.setRenderBounds(.75, 0, .375, 1, 1, .625); ClientUtils.drawInventoryBlock(block, metadata, renderer); renderer.setRenderBounds(-.125, .8125, .4375, 1.125, .9375, .5625); ClientUtils.drawInventoryBlock(block, metadata, renderer); renderer.setRenderBounds(-.125, .3125, .4375, 1.125, .4375, .5625); ClientUtils.drawInventoryBlock(block, metadata, renderer); GL11.glTranslatef(.5f, .5f, .5f); } else if (metadata == BlockMetalDecoration.META_scaffolding) { block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); renderer.setRenderBoundsFromBlock(block); ClientUtils.drawInventoryBlock(block, metadata, renderer); } else if (metadata == BlockMetalDecoration.META_lantern) { Tessellator.instance.startDrawingQuads(); ClientUtils.handleStaticTileRenderer(new TileEntityLantern()); Tessellator.instance.draw(); } else if (metadata == BlockMetalDecoration.META_structuralArm) { Tessellator tes = ClientUtils.tes(); IIcon iSide = block.getIcon(2, 3); IIcon iTop = block.getIcon(0, 3); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); tes.startDrawing(6); tes.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, 0, 0, 0, iTop); tes.draw(); tes.startDrawing(6); tes.setNormal(0.0F, 1.0F, 0.0F); tes.setBrightness(0xff); tes.addVertexWithUV(1, 1, 1, iTop.getMaxU(), iTop.getMaxV()); tes.addVertexWithUV(1, 1, 0, iTop.getMaxU(), iTop.getMinV()); tes.addVertexWithUV(0, 0, 0, iTop.getMinU(), iTop.getMinV()); tes.addVertexWithUV(0, 0, 1, iTop.getMinU(), iTop.getMaxV()); tes.draw(); tes.startDrawing(6); tes.setNormal(0.0F, 0.0F, -1.0F); tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getInterpolatedV(0 * 16)); tes.addVertexWithUV(1, 1, 0, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16)); tes.addVertexWithUV(1, 0, 0, iSide.getMaxU(), iSide.getMinV()); tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getMinV()); tes.draw(); tes.startDrawing(6); tes.setNormal(0.0F, 0.0F, 1.0F); tes.addVertexWithUV(1, 1, 1, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16)); tes.addVertexWithUV(0, 0, 1, iSide.getMinU(), iSide.getInterpolatedV(0 * 16)); tes.addVertexWithUV(0, 0, 1, iSide.getMinU(), iSide.getMinV()); tes.addVertexWithUV(1, 0, 1, iSide.getMaxU(), iSide.getMinV()); tes.draw(); tes.startDrawing(6); tes.setNormal(-1.0F, 0.0F, 0.0F); tes.addVertexWithUV(0, 0, 1, iSide.getMaxU(), iSide.getInterpolatedV(0 * 16)); tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getInterpolatedV(0 * 16)); tes.addVertexWithUV(0, 0, 0, iSide.getMinU(), iSide.getMinV()); tes.addVertexWithUV(0, 0, 1, iSide.getMaxU(), iSide.getMinV()); tes.draw(); tes.startDrawing(6); tes.setNormal(1.0F, 0.0F, 0.0F); tes.addVertexWithUV(1, 1, 0, iSide.getMinU(), iSide.getInterpolatedV(1 * 16)); tes.addVertexWithUV(1, 1, 1, iSide.getMaxU(), iSide.getInterpolatedV(1 * 16)); tes.addVertexWithUV(1, 0, 1, iSide.getMaxU(), iSide.getMinV()); tes.addVertexWithUV(1, 0, 0, iSide.getMinU(), iSide.getMinV()); tes.draw(); } else if (metadata == BlockMetalDecoration.META_connectorStructural) { Tessellator.instance.startDrawingQuads(); ClientUtils.handleStaticTileRenderer(new TileEntityConnectorStructural()); Tessellator.instance.draw(); } else if (metadata == BlockMetalDecoration.META_wallMount) { Tessellator.instance.startDrawingQuads(); ClientUtils.handleStaticTileRenderer(new TileEntityWallmountMetal()); Tessellator.instance.draw(); } else { block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); renderer.setRenderBoundsFromBlock(block); ClientUtils.drawInventoryBlock(block, metadata, renderer); } } catch (Exception e) { e.printStackTrace(); } GL11.glPopMatrix(); }
@Override public boolean renderWorldBlock( IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) { if (modelID == renderID) { CastingChannelLogic tile = (CastingChannelLogic) world.getBlockTileEntity(x, y, z); if (!tile.hasTankConnected( ForgeDirection.DOWN)) // CentrePiece, floor is removed if tank below is found { renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.6875D, 0.5D, 0.6875D); renderer.renderStandardBlock(block, x, y, z); } else // "Guiding Borders" when tank below is found { renderer.setRenderBounds(0.375D, 0.125D, 0.3125D, 0.625D, 0.5D, 0.375D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.375D, 0.125D, 0.625D, 0.625D, 0.5D, 0.6875D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.3125D, 0.125D, 0.3125D, 0.375D, 0.5D, 0.6875D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.625D, 0.125D, 0.3125D, 0.6875D, 0.5D, 0.6875D); renderer.renderStandardBlock(block, x, y, z); } /*renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.375D, 0.625D, 0.375D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.3125D, 0.375D, 0.625D, 0.375D, 0.625D, 0.6875D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.625D, 0.375D, 0.3125D, 0.6875D, 0.625D, 0.375D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.625D, 0.375D, 0.625D, 0.6875D, 0.625D, 0.6875D); renderer.renderStandardBlock(block, x, y, z);*/ if (tile.hasTankConnected(ForgeDirection.NORTH)) // Channel to Z- { renderer.setRenderBounds(0.3125D, 0.375D, 0D, 0.6875D, 0.5D, 0.3125D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.3125D, 0.5D, 0D, 0.375D, 0.625D, 0.3125D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.625D, 0.5D, 0D, 0.6875D, 0.625D, 0.3125D); renderer.renderStandardBlock(block, x, y, z); } else // Wall to Z- { renderer.setRenderBounds(0.375D, 0.5D, 0.3125D, 0.625D, 0.625D, 0.375D); renderer.renderStandardBlock(block, x, y, z); } if (tile.hasTankConnected(ForgeDirection.SOUTH)) // Channel to Z+ { renderer.setRenderBounds(0.3125D, 0.375D, 0.6875D, 0.6875D, 0.5D, 1D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.3125D, 0.5D, 0.6875D, 0.375D, 0.625D, 1D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.625D, 0.5D, 0.6875D, 0.6875D, 0.625D, 1D); renderer.renderStandardBlock(block, x, y, z); } else // Wall to Z+ { renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.625D, 0.6875D); renderer.renderStandardBlock(block, x, y, z); } if (tile.hasTankConnected(ForgeDirection.WEST)) // Channel to X- { renderer.setRenderBounds(0D, 0.375D, 0.3125D, 0.3125D, 0.5D, 0.6875D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0D, 0.5D, 0.3125D, 0.375D, 0.625D, 0.375D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0D, 0.5D, 0.625D, 0.375D, 0.625D, 0.6875D); renderer.renderStandardBlock(block, x, y, z); } else // Wall to X- { renderer.setRenderBounds(0.3125D, 0.5D, 0.3125D, 0.375D, 0.625D, 0.6875D); renderer.renderStandardBlock(block, x, y, z); } if (tile.hasTankConnected(ForgeDirection.EAST)) // Channel to X+ { renderer.setRenderBounds(0.6875D, 0.375D, 0.3125D, 1D, 0.5D, 0.6875D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.625D, 0.5D, 0.3125D, 1D, 0.625D, 0.375D); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.625D, 0.5D, 0.625D, 1D, 0.625D, 0.6875D); renderer.renderStandardBlock(block, x, y, z); } else // Wall to X+ { renderer.setRenderBounds(0.625D, 0.5D, 0.3125D, 0.6875D, 0.625D, 0.6875D); renderer.renderStandardBlock(block, x, y, z); } if (tile.liquid != null) { float height = tile.getLiquidAmount() / (tile.getCapacity() * 1.05F); float j = tile.liquid.amount / tile.fillMax; double startY = tile.tankBelow(); // if(tile.nearbyChannel(ForgeDirection.DOWN))startY = -0.5D; // else if(tile.hasTankConnected(ForgeDirection.DOWN))startY = 0D; float liquidAmount = tile.liquid.amount / 288f * 0.125f; renderer.setRenderBounds( 0.375D, startY, 0.375D, 0.625D, 0.5 + liquidAmount, 0.625D); // Center renderLiquidPart(world, x, y, z, block, renderer, tile); // System.out.println(tile.recentlyFilledDelay); if (tile.hasTankConnected(ForgeDirection.NORTH)) { if (tile.lastProvider == ForgeDirection.NORTH) { renderer.setRenderBounds(0.375D, 0.5D, 0D, 0.625D, 0.5 + liquidAmount, 0.375D); renderLiquidPart(world, x, y, z, block, renderer, tile); } else { if (tile.recentlyFilledDelay == 0) { renderer.setRenderBounds(0.375D, 0.5D, 0D, 0.625D, 0.5 + liquidAmount, 0.375D); renderLiquidPart(world, x, y, z, block, renderer, tile); } } } if (tile.hasTankConnected(ForgeDirection.SOUTH)) { if (tile.lastProvider == ForgeDirection.SOUTH) { renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.5 + liquidAmount, 1D); renderLiquidPart(world, x, y, z, block, renderer, tile); } else { if (tile.recentlyFilledDelay == 0) { renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.5 + liquidAmount, 1D); renderLiquidPart(world, x, y, z, block, renderer, tile); } } } if (tile.hasTankConnected(ForgeDirection.WEST)) { if (tile.lastProvider == ForgeDirection.WEST) { renderer.setRenderBounds(0D, 0.5D, 0.375D, 0.375D, 0.5 + liquidAmount, 0.625D); renderLiquidPart(world, x, y, z, block, renderer, tile); } else { if (tile.recentlyFilledDelay == 0) { renderer.setRenderBounds(0D, 0.5D, 0.375D, 0.375D, 0.5 + liquidAmount, 0.625D); renderLiquidPart(world, x, y, z, block, renderer, tile); } } } if (tile.hasTankConnected(ForgeDirection.EAST)) { if (tile.lastProvider == ForgeDirection.EAST) { renderer.setRenderBounds(0.625D, 0.5D, 0.375D, 1D, 0.5 + liquidAmount, 0.625D); renderLiquidPart(world, x, y, z, block, renderer, tile); } else { if (tile.recentlyFilledDelay == 0) { renderer.setRenderBounds(0.625D, 0.5D, 0.375D, 1D, 0.5 + liquidAmount, 0.625D); renderLiquidPart(world, x, y, z, block, renderer, tile); } } } /*if(tile.lastProvider==ForgeDirection.UP && tile.recentlyFilledDelay != 0) { renderer.setRenderBounds(0.375D, 0.5D, 0.375D, 0.625D, 1D, 0.625D); renderLiquidPart(world, x, y, z, block, renderer, tile); }*/ /*if(tile.hasTankConnected(ForgeDirection.NORTH)&&tile.lastProvider!=ForgeDirection.NORTH)//Channel to Z- { if(tile.recentlyFilledDelay == 0 || tile.lastProvider == ForgeDirection.UP) { renderer.setRenderBounds(0.375D, 0.5D, 0D, 0.625D, 0.625D, 0.375D); renderLiquidPart(world, x, y, z, block, renderer, tile); } if(tile.recentlyFilledDelay != 0 && tile.lastProvider == ForgeDirection.UP) { renderer.setRenderBounds(0.375D, 0.375D, 0.375D, 0.625D, 1D, 0.625D); renderLiquidPart(world, x, y, z, block, renderer, tile); } } if(tile.hasTankConnected(ForgeDirection.SOUTH)&&tile.lastProvider!=ForgeDirection.SOUTH)//Channel to Z+ { if(tile.recentlyFilledDelay == 0 || tile.lastProvider == ForgeDirection.UP) { renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.625D, 1D); renderLiquidPart(world, x, y, z, block, renderer, tile); } if(tile.recentlyFilledDelay != 0 && tile.lastProvider == ForgeDirection.UP) { renderer.setRenderBounds(0.375D, 0.375D, 0.375D, 0.625D, 1D, 0.625D); renderLiquidPart(world, x, y, z, block, renderer, tile); } } if(tile.hasTankConnected(ForgeDirection.WEST)&&tile.lastProvider!=ForgeDirection.WEST)//Channel to X- { if(tile.recentlyFilledDelay == 0 || tile.lastProvider == ForgeDirection.UP) { renderer.setRenderBounds(0D, 0.5D, 0.375D, 0.375D, 0.625D, 0.625D); renderLiquidPart(world, x, y, z, block, renderer, tile); } if(tile.recentlyFilledDelay != 0 && tile.lastProvider == ForgeDirection.UP) { renderer.setRenderBounds(0.375D, 0.375D, 0.375D, 0.625D, 1D, 0.625D); renderLiquidPart(world, x, y, z, block, renderer, tile); } } if(tile.hasTankConnected(ForgeDirection.EAST)&&tile.lastProvider!=ForgeDirection.EAST)//Channel to X+ { if(tile.recentlyFilledDelay == 0 || tile.lastProvider == ForgeDirection.UP) { renderer.setRenderBounds(0.625D, 0.5D, 0.375D, 1D, 0.625D, 0.625D); renderLiquidPart(world, x, y, z, block, renderer, tile); } if(tile.recentlyFilledDelay != 0 && tile.lastProvider == ForgeDirection.UP) { renderer.setRenderBounds(0.375D, 0.375D, 0.375D, 0.625D, 1D, 0.625D); renderLiquidPart(world, x, y, z, block, renderer, tile); } } if(tile.lastProvider==ForgeDirection.NORTH && tile.recentlyFilledDelay != 0) { renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.625D, 1D); renderLiquidPart(world, x, y, z, block, renderer, tile); } if(tile.lastProvider==ForgeDirection.SOUTH && tile.recentlyFilledDelay != 0) { renderer.setRenderBounds(0.375D, 0.5D, 0D, 0.625D, 0.625D, 0.375D); renderLiquidPart(world, x, y, z, block, renderer, tile); } if(tile.lastProvider==ForgeDirection.WEST && tile.recentlyFilledDelay != 0) { renderer.setRenderBounds(0.625D, 0.5D, 0.375D, 1D, 0.625D, 0.625D); renderLiquidPart(world, x, y, z, block, renderer, tile); } if(tile.lastProvider==ForgeDirection.EAST && tile.recentlyFilledDelay != 0) { renderer.setRenderBounds(0D, 0.5D, 0.375D, 0.375D, 0.625D, 0.625D); renderLiquidPart(world, x, y, z, block, renderer, tile); }*/ } } return true; }
@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; }
@Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { Tessellator tessellator = Tessellator.instance; if (metadata == 0) { renderer.setRenderBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.0625F, 0.9375F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.1875F, 0.0625F, 0.1875F, 0.8125F, 0.25F, 0.8125F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.4375F, 0.75F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.3125F, 0.4375F, 0.3125F, 0.6875F, 0.625F, 0.6875F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.375F, 0.625F, 0.375F, 0.625F, 0.8125F, 0.625F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.4375F, 0.8125F, 0.4375F, 0.5625F, 1F, 0.5625F); this.renderInInventory(tessellator, renderer, block, metadata); } if (metadata == 1) { renderer.setRenderBounds(0.125F, 0.0F, 0.0625F, 0.875F, 0.0625F, 0.9375F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.0625F, 0.0F, 0.125F, 0.125F, 0.0625F, 0.875F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.875F, 0.0F, 0.125F, 0.9375F, 0.0625F, 0.875F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.3125F, 0.0625F, 0.255F, 0.6875F, 0.875F, 0.75F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.255F, 0.0625F, 0.3125F, 0.3125F, 0.875F, 0.6875F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.6875F, 0.0625F, 0.3125F, 0.75F, 0.875F, 0.6875F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.3125F, 0.9375F, 0.4375F, 0.6875F, 1F, 0.5625F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.3125F, 0.875F, 0.4375F, 0.375F, 0.9375F, 0.5625F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.625F, 0.875F, 0.4375F, 0.6875F, 0.9375F, 0.5625F); this.renderInInventory(tessellator, renderer, block, metadata); } if (metadata == 2) { renderer.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.0625F, 0.75F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.375F, 0.0625F, 0.375F, 0.625F, 0.125F, 0.625F); this.renderInInventory(tessellator, renderer, block, metadata); renderer.setRenderBounds(0.4375F, 0.125F, 0.4375F, 0.5625F, 1.0F, 0.5625F); this.renderInInventory(tessellator, renderer, block, metadata); } }
@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); }
@Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { if (modelID == RENDER_ID) { final BlockBrewKettle brewKettle = (BlockBrewKettle) block; final Tessellator tes = Tessellator.instance; final IIcon[] icon = { brewKettle.getIconByIndex(0), brewKettle.getIconByIndex(3), brewKettle.getIconByIndex(2), brewKettle.getIconByIndex(2), brewKettle.getIconByIndex(2), brewKettle.getIconByIndex(2) }; renderer.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); // Outer Kettle RenderUtils.renderInventoryBlockOverride(block, renderer, icon, tes); final float f = 0.125F; GL11.glTranslatef(-0.5F, -0.5F, -0.5F); // Inner Kettle RenderUtils.drawFace( RenderUtils.Face.ZNEG, block, renderer, tes, brewKettle.getIconByIndex(2), 0.0D, 0.0D, (double) (0.0F + 1.0F - f)); RenderUtils.drawFace( RenderUtils.Face.ZPOS, block, renderer, tes, brewKettle.getIconByIndex(2), 0.0D, 0.0D, (double) (0.0F - 1.0F + f)); RenderUtils.drawFace( RenderUtils.Face.XNEG, block, renderer, tes, brewKettle.getIconByIndex(2), (double) (0.0F + 1.0F - f), 0.0D, 0.0D); RenderUtils.drawFace( RenderUtils.Face.XPOS, block, renderer, tes, brewKettle.getIconByIndex(2), (double) (0.0F - 1.0F + f), 0.0D, 0.0D); RenderUtils.drawFace( RenderUtils.Face.YPOS, block, renderer, tes, brewKettle.getIconByIndex(1), 0.0D, (double) (0.0F - 1.0F + 0.25F), 0.0D); RenderUtils.drawFace( RenderUtils.Face.YNEG, block, renderer, tes, brewKettle.getIconByIndex(1), 0.0D, (double) (0.0F + 1.0F - 0.75F), 0.0D); GL11.glTranslatef(0.5F, 0.5F, 0.5F); renderer.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); } }
@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; }
@Override public boolean renderWorldBlock( IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { if (world.getBlockMetadata(x, y, z) == 0) { renderer.setRenderBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.0625F, 0.9375F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.1875F, 0.0625F, 0.1875F, 0.8125F, 0.25F, 0.8125F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.4375F, 0.75F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.3125F, 0.4375F, 0.3125F, 0.6875F, 0.625F, 0.6875F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.375F, 0.625F, 0.375F, 0.625F, 0.8125F, 0.625F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.4375F, 0.8125F, 0.4375F, 0.5625F, 1F, 0.5625F); renderer.renderStandardBlock(block, x, y, z); } if (world.getBlockMetadata(x, y, z) == 1) { renderer.setRenderBounds(0.125F, 0.0F, 0.0625F, 0.875F, 0.0625F, 0.9375F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.0625F, 0.0F, 0.125F, 0.125F, 0.0625F, 0.875F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.875F, 0.0F, 0.125F, 0.9375F, 0.0625F, 0.875F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.3125F, 0.0625F, 0.255F, 0.6875F, 0.875F, 0.75F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.255F, 0.0625F, 0.3125F, 0.3125F, 0.875F, 0.6875F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.6875F, 0.0625F, 0.3125F, 0.75F, 0.875F, 0.6875F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.3125F, 0.9375F, 0.4375F, 0.6875F, 1F, 0.5625F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.3125F, 0.875F, 0.4375F, 0.375F, 0.9375F, 0.5625F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.625F, 0.875F, 0.4375F, 0.6875F, 0.9375F, 0.5625F); renderer.renderStandardBlock(block, x, y, z); } if (world.getBlockMetadata(x, y, z) == 2) { renderer.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.0625F, 0.75F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.375F, 0.0625F, 0.375F, 0.625F, 0.125F, 0.625F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0.4375F, 0.125F, 0.4375F, 0.5625F, 1.2F, 0.5625F); renderer.renderStandardBlock(block, x, y, z); } return true; }