Java Code Examples for net.minecraft.client.renderer.RenderBlocks#setRenderBounds()
The following examples show how to use
net.minecraft.client.renderer.RenderBlocks#setRenderBounds() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockTexturedOreRenderer.java From Chisel with GNU General Public License v2.0 | 6 votes |
@Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer) { if(blck == null || !(blck instanceof BlockTexturedOre)) return false; BlockTexturedOre block = (BlockTexturedOre) blck; if(block.currentPass == 0) { if(block.icon != null) { renderer.overrideBlockTexture = block.icon; renderer.renderStandardBlock(block, x, y, z); renderer.overrideBlockTexture = null; } else if(block.base != null) { renderer.renderBlockByRenderType(block.base, x, y, z); } } else { renderer.setRenderBounds(bot, bot, bot, top, top, top); renderer.renderStandardBlock(block, x, y, z); } return true; }
Example 2
Source File: RenderBlockSeat.java From archimedes-ships with MIT License | 6 votes |
@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.setRenderBounds(0D, 0D, 0D, 1D, block.getBlockBoundsMaxY(), 1D); renderer.renderAllFaces = true; renderer.renderStandardBlock(block, x, y, z); if (meta == 0) { renderer.setRenderBounds(0D, block.getBlockBoundsMaxY(), 0.8D, 1D, 1D, 1D); } else if (meta == 1) { renderer.setRenderBounds(0D, block.getBlockBoundsMaxY(), 0D, 0.2D, 1D, 1D); } else if (meta == 2) { renderer.setRenderBounds(0D, block.getBlockBoundsMaxY(), 0D, 1D, 1D, 0.2D); } else if (meta == 3) { renderer.setRenderBounds(0.8D, block.getBlockBoundsMaxY(), 0D, 1D, 1D, 1D); } renderer.renderStandardBlock(block, x, y, z); renderer.renderAllFaces = false; return false; }
Example 3
Source File: BlockTexturedOreRenderer.java From Chisel with GNU General Public License v2.0 | 6 votes |
@Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer) { if(blck == null || !(blck instanceof BlockTexturedOre)) return false; BlockTexturedOre block = (BlockTexturedOre) blck; if(block.currentPass == 0) { if(block.icon != null) { renderer.overrideBlockTexture = block.icon; renderer.renderStandardBlock(block, x, y, z); renderer.overrideBlockTexture = null; } else if(block.base != null) { renderer.renderBlockByRenderType(block.base, x, y, z); } } else { renderer.setRenderBounds(bot, bot, bot, top, top, top); renderer.renderStandardBlock(block, x, y, z); } return true; }
Example 4
Source File: GroundCoverPlantRenderer.java From GardenCollection with MIT License | 6 votes |
@Override public void render (IBlockAccess world, int x, int y, int z, RenderBlocks renderer, Block block, int meta, int height, AxisAlignedBB[] bounds) { IPlantMetaResolver resolver = PlantRegistry.instance().getPlantMetaResolver(block, meta); if (resolver != null) meta = resolver.getPlantSectionMeta(block, meta, height); IIcon icon = renderer.getBlockIconFromSideAndMetadata(block, 0, meta); renderer.setRenderBounds(0, 0, 0, 1, .03125, 1); renderer.renderFaceYPos(block, x, y, z, icon); /*float f = 0.1F; double d0 = (double)icon.getMinU(); double d1 = (double)icon.getMinV(); double d2 = (double)icon.getMaxU(); double d3 = (double)icon.getMaxV(); float f1 = (float)x + 0.5F; float f2 = (float)z + 0.5F; float f3 = (float)(i1 & 1) * 0.5F * (float)(1 - i1 / 2 % 2 * 2); float f4 = (float)(i1 + 1 & 1) * 0.5F * (float)(1 - (i1 + 1) / 2 % 2 * 2);*/ }
Example 5
Source File: RendererMultiLayer.java From Chisel-2 with GNU General Public License v2.0 | 6 votes |
@Override public void renderInventoryBlock(Block blck, int meta, int modelID, RenderBlocks renderer) { if (blck == null || !(blck instanceof BlockMultiLayerBase)) return; BlockMultiLayerBase block = (BlockMultiLayerBase) blck; if (block.icon != null) { renderer.overrideBlockTexture = block.icon; renderer.renderBlockAsItem(Blocks.stone, meta, 1.0f); renderer.overrideBlockTexture = null; } else if (block.base != null) { renderer.renderBlockAsItem(block.base, meta, 1.0f); } glPushMatrix(); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); renderer.setRenderBounds(bot, bot, bot, top, top, top); glTranslatef(-0.5F, -0.5F, -0.5F); Drawing.drawBlock(block, meta, renderer); glDisable(GL_BLEND); glPopMatrix(); }
Example 6
Source File: BlockTexturedOreRenderer.java From Chisel-2 with GNU General Public License v2.0 | 6 votes |
@Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer) { if (blck == null || !(blck instanceof BlockTexturedOre)) return false; BlockTexturedOre block = (BlockTexturedOre) blck; if (block.currentPass == 0) { if (block.icon != null) { renderer.overrideBlockTexture = block.icon; renderer.renderStandardBlock(block, x, y, z); renderer.overrideBlockTexture = null; } else if (block.base != null) { renderer.renderBlockByRenderType(block.base, x, y, z); } } else { renderer.setRenderBounds(bot, bot, bot, top, top, top); renderer.renderStandardBlock(block, x, y, z); } return true; }
Example 7
Source File: RenderChargingStationPad.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
@Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer){ TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityChargingStation) { TileEntityChargingStation station = (TileEntityChargingStation)te; if(station.getUpgrades(ItemMachineUpgrade.UPGRADE_DISPENSER_DAMAGE) > 0) { ItemStack camo = station.getCamoStack(); Block camoBlock = ((ItemBlock)camo.getItem()).field_150939_a; renderer.renderAllFaces = true; renderer.setOverrideBlockTexture(camoBlock.getIcon(0, camo.getItemDamage())); renderer.setRenderBounds(0, 15 / 16D, 0, 1, 1, 1); renderer.renderStandardBlock(block, x, y, z); renderer.setOverrideBlockTexture(null); renderer.renderAllFaces = false; return true; } } return false; }
Example 8
Source File: BlockChorusFlowerRender.java From Et-Futurum with The Unlicense | 6 votes |
@Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { renderer.renderAllFaces = true; renderer.setRenderBounds(2 / 16F, 14 / 16F, 2 / 16F, 14 / 16F, 1, 14 / 16F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(0, 2 / 16F, 2 / 16F, 2 / 16F, 14 / 16F, 14 / 16F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(2 / 16F, 2 / 16F, 0, 14 / 16F, 14 / 16F, 2 / 16F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(2 / 16F, 2 / 16F, 14 / 16F, 14 / 16F, 14 / 16F, 1); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(14 / 16F, 2 / 16F, 2 / 16F, 1, 14 / 16F, 14 / 16F); renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBounds(2 / 16F, 0, 2 / 16F, 14 / 16F, 14 / 16F, 14 / 16F); renderer.renderStandardBlock(block, x, y, z); renderer.renderAllFaces = false; return true; }
Example 9
Source File: BlockNoCTMRenderer.java From Chisel with GNU General Public License v2.0 | 5 votes |
@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); if(meta != 0) renderer.overrideBlockTexture = block.getIcon(0, meta); renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); renderer.renderStandardBlock(block, x, y, z); renderer.overrideBlockTexture = null; return false; }
Example 10
Source File: ModelCertusTank.java From ExtraCells1 with MIT License | 5 votes |
public void renderFluid(TileEntity tileEntity, double x, double y, double z, RenderBlocks renderer) { Tessellator tessellator = Tessellator.instance; tessellator.setColorOpaque(255, 255, 255); if (tileEntity != null && ((TileEntityCertusTank) tileEntity).getTankInfo(ForgeDirection.UNKNOWN)[0].fluid != null) { Fluid storedFluid = ((TileEntityCertusTank) tileEntity).getRenderFluid(); float scale = ((TileEntityCertusTank) tileEntity).getRenderScale(); if (storedFluid != null && scale > 0) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Block id = Block.blocksList[FluidRegistry.WATER.getBlockID()]; Icon fluidIcon = storedFluid.getIcon(); if (fluidIcon == null) fluidIcon = FluidRegistry.LAVA.getIcon(); renderer.setRenderBounds(0.08F, 0.001F, 0.08F, 0.92, scale * 0.999F, 0.92F); tessellator.setNormal(0.0F, -1F, 0.0F); renderer.renderFaceYNeg(id, x, y, z, fluidIcon); tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(id, x, y, z, fluidIcon); tessellator.setNormal(0.0F, 0.0F, -1F); renderer.renderFaceZNeg(id, x, y, z, fluidIcon); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(id, x, y, z, fluidIcon); tessellator.setNormal(-1F, 0.0F, 0.0F); renderer.renderFaceXNeg(id, x, y, z, fluidIcon); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(id, x, y, z, fluidIcon); } } }
Example 11
Source File: ThinLogFenceRenderer.java From GardenCollection with MIT License | 5 votes |
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(); }
Example 12
Source File: RenderElevatorFrame.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer){ boolean frameXPos = world.getBlock(x + 1, y, z) == Blockss.elevatorFrame; boolean frameXNeg = world.getBlock(x - 1, y, z) == Blockss.elevatorFrame; boolean frameZPos = world.getBlock(x, y, z + 1) == Blockss.elevatorFrame; boolean frameZNeg = world.getBlock(x, y, z - 1) == Blockss.elevatorFrame; TileEntityElevatorBase base = BlockElevatorFrame.getElevatorTE(world, x, y, z); renderer.renderAllFaces = true; if(base != null && base.frameCamo != null && PneumaticCraftUtils.isRenderIDCamo(base.frameCamo.getRenderType())) { renderer.setOverrideBlockTexture(base.frameCamo.getIcon(0, base.getStackInSlot(5).getItemDamage())); } if(!frameXPos && !frameZPos) { renderer.setRenderBounds(14 / 16D, 0, 14 / 16D, 15 / 16D, 1, 15 / 16D); renderer.renderStandardBlock(block, x, y, z); } if(!frameXNeg && !frameZPos) { renderer.setRenderBounds(1 / 16D, 0, 14 / 16D, 2 / 16D, 1, 15 / 16D); renderer.renderStandardBlock(block, x, y, z); } if(!frameXPos && !frameZNeg) { renderer.setRenderBounds(14 / 16D, 0, 1 / 16D, 15 / 16D, 1, 2 / 16D); renderer.renderStandardBlock(block, x, y, z); } if(!frameXNeg && !frameZNeg) { renderer.setRenderBounds(1 / 16D, 0, 1 / 16D, 2 / 16D, 1, 2 / 16D); renderer.renderStandardBlock(block, x, y, z); } renderer.setOverrideBlockTexture(null); renderer.renderAllFaces = false; return true; }
Example 13
Source File: BlockSlimeBlockRender.java From Et-Futurum with The Unlicense | 5 votes |
@Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { renderer.renderStandardBlock(ModBlocks.slime, x, y, z); float f = 0.0625F; renderer.setRenderBounds(f * 3, f * 3, f * 3, f * 13, f * 13, f * 13); renderer.renderAllFaces = true; boolean flag = renderer.renderStandardBlock(ModBlocks.slime, x, y, z); renderer.renderAllFaces = false; return flag; }
Example 14
Source File: TileEntityEndRodRenderer.java From Et-Futurum with The Unlicense | 4 votes |
public static void renderRod(RenderBlocks renderer, Block block, int meta) { Tessellator tessellator = Tessellator.instance; double x = 7 / 16.0; double y = 0; double z = 7 / 16.0; renderer.setRenderBounds(0, 1 / 16F, 0, 2 / 16F, 1, 2 / 16F); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 0, meta)); tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 1, meta)); tessellator.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 2, meta)); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 3, meta)); tessellator.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 4, meta)); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 5, meta)); tessellator.draw(); x = 4 / 16.0; y = 0; z = 4 / 16.0; renderer.setRenderBounds(2 / 16F, 0, 2 / 16F, 6 / 16F, 1 / 16F, 6 / 16F); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 0, meta)); tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 1, meta)); y = -13 / 16.0; renderer.setRenderBounds(2 / 16F, 13 / 16F, 2 / 16F, 6 / 16F, 14 / 16F, 6 / 16F); tessellator.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 2, meta)); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 3, meta)); tessellator.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 4, meta)); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 5, meta)); tessellator.draw(); }
Example 15
Source File: RenderFakeBlock.java From Artifacts with MIT License | 4 votes |
@Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { float f = 0.03125F; float xn = 0F; float xp = 1F; float yn = 0F; float yp = 1F; float zn = 0F; float zp = 1F; if(!world.getBlock(x-1, y, z).isOpaqueCube()) { if(world.getBlock(x-1, y, z) != block) xn = f; } if(!world.getBlock(x+1, y, z).isOpaqueCube()) { if(world.getBlock(x+1, y, z) != block) xp = 1F-f; } if(!world.getBlock(x, y-1, z).isOpaqueCube()) { if(world.getBlock(x, y-1, z) != block) yn = f; } if(!world.getBlock(x, y+1, z).isOpaqueCube()) { if(world.getBlock(x, y+1, z) != block) yp = 1F-f; } if(!world.getBlock(x, y, z-1).isOpaqueCube()) { if(world.getBlock(x, y, z-1) != block) zn = f; } if(!world.getBlock(x, y, z+1).isOpaqueCube()) { if(world.getBlock(x, y, z+1) != block) zp = 1F-f; } //block.setBlockBounds(xn, yn, zn, xp, yp, zp); renderer.setRenderBounds(xn, yn, zn, xp, yp, zp); int l = block.colorMultiplier(world, x, y, z); float f0 = (float)(l >> 16 & 255) / 255.0F; float f1 = (float)(l >> 8 & 255) / 255.0F; float f2 = (float)(l & 255) / 255.0F; if (EntityRenderer.anaglyphEnable) { float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F; float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F; float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F; f0 = f3; f1 = f4; f2 = f5; } //if() { /*f0 *= 1.5; f1 *= 1.5; f2 *= 1.5;*/ //} return renderer.renderStandardBlockWithColorMultiplier(block, x, y, z, f0, f1, f2); }
Example 16
Source File: ItemRendererCertusTank.java From ExtraCells1 with MIT License | 4 votes |
public void renderItem(ItemRenderType type, ItemStack item, Object... data) { Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/blocks/texmap_tank.png")); GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glScalef(1.0F, -1F, -1F); model.render(0.0625f); GL11.glScalef(1.0F, -1F, 1.0F); model.render(0.0625f); if (item != null && item.hasTagCompound()) { FluidStack storedFluid = FluidStack.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("tileEntity")); int tankCapacity = 32000; if (storedFluid != null && storedFluid.getFluid() != null) { Icon fluidIcon = storedFluid.getFluid().getIcon(); Tessellator tessellator = Tessellator.instance; RenderBlocks renderer = new RenderBlocks(); GL11.glScalef(1.0F, 1.0F, -1.0F); renderer.setRenderBounds(0.08F, 0.001F, 0.08F, 0.92, (float) storedFluid.amount / (float) tankCapacity * 0.999F, 0.92F); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1F, 0.0F); renderer.renderFaceYNeg(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1F); renderer.renderFaceZNeg(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(-1F, 0.0F, 0.0F); renderer.renderFaceXNeg(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon); tessellator.draw(); GL11.glPopAttrib(); } } GL11.glPopMatrix(); }
Example 17
Source File: BlockSlimeBlockRender.java From Et-Futurum with The Unlicense | 4 votes |
@Override public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) { Tessellator tessellator = Tessellator.instance; OpenGLHelper.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); OpenGLHelper.enableBlend(); OpenGLHelper.translate(-0.5F, -0.5F, -0.5F); float f = 0.0625F; renderer.setRenderBounds(f * 3, f * 3, f * 3, f * 13, f * 13, f * 13); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, meta)); tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, meta)); tessellator.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, meta)); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, meta)); tessellator.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, meta)); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, meta)); tessellator.draw(); renderer.setRenderBounds(0, 0, 0, 1, 1, 1); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, meta)); tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, meta)); tessellator.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, meta)); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, meta)); tessellator.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, meta)); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, meta)); tessellator.draw(); OpenGLHelper.translate(0.5F, 0.5F, 0.5F); OpenGLHelper.disableBlend(); }
Example 18
Source File: RotorSimpleRenderer.java From BigReactors with MIT License | 4 votes |
private static void renderRotorBladeConnection(RenderBlocks renderer, Block block, int metadata, ForgeDirection rotorDir, ForgeDirection bladeDir, int x, int y, int z, boolean drawOuterRectangle) { // This is the dimension in which the blade expands ForgeDirection normal = findNormal(rotorDir, bladeDir); // Used for proper calculation of the IJK coords int rotorDirMultiplier = rotorDir.offsetX < 0 || rotorDir.offsetY < 0 || rotorDir.offsetZ < 0 ? -1 : 1; int bladeDirMultiplier = bladeDir.offsetX < 0 || bladeDir.offsetY < 0 || bladeDir.offsetZ < 0 ? -1 : 1; int normalDirMultiplier = normal.offsetX < 0 || normal.offsetY < 0 || normal.offsetZ < 0 ? -1 : 1; // Compute the 8 coordinates of the inner and outer rectangles in IJK space, which we'll re-orient later // I = blade dir, J = rotor dir, K = normal dir double rotorDirectionOffset = 0.05D; double bladeInnerOffset = 0.2D; double bladeOuterOffset = 0.5D; double normalInnerOffset = 0.2D; double normalOuterOffset = 0.4D; double rotorOffsets[] = new double[8]; rotorOffsets[0] = rotorOffsets[3] = rotorOffsets[4] = rotorOffsets[7] = 0.5D + (rotorDirMultiplier * rotorDirectionOffset); rotorOffsets[1] = rotorOffsets[2] = rotorOffsets[5] = rotorOffsets[6] = 0.5D - (rotorDirMultiplier * rotorDirectionOffset); double bladeOffsets[] = new double[8]; bladeOffsets[0] = bladeOffsets[1] = bladeOffsets[2] = bladeOffsets[3] = 0.5D + (bladeDirMultiplier * bladeInnerOffset); bladeOffsets[4] = bladeOffsets[5] = bladeOffsets[6] = bladeOffsets[7] = 0.5D + (bladeDirMultiplier * bladeOuterOffset); double normalOffsets[] = new double[8]; normalOffsets[0] = normalOffsets[1] = 0.5D - (normalDirMultiplier * normalInnerOffset); normalOffsets[2] = normalOffsets[3] = 0.5D + (normalDirMultiplier * normalInnerOffset); normalOffsets[4] = normalOffsets[5] = 0.5D - (normalDirMultiplier * normalOuterOffset); normalOffsets[6] = normalOffsets[7] = 0.5D + (normalDirMultiplier * normalOuterOffset); // Now calculate our 8 coordinates in XYZ space from IJK space double[] xCoords = {0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D}; double[] yCoords = {0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D}; double[] zCoords = {0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D}; int xMagRotor = Math.abs(rotorDir.offsetX); int xMagBlade = Math.abs(bladeDir.offsetX); int xMagNormal = Math.abs(normal.offsetX); int yMagRotor = Math.abs(rotorDir.offsetY); int yMagBlade = Math.abs(bladeDir.offsetY); int yMagNormal = Math.abs(normal.offsetY); int zMagRotor = Math.abs(rotorDir.offsetZ); int zMagBlade = Math.abs(bladeDir.offsetZ); int zMagNormal = Math.abs(normal.offsetZ); for(int i = 0; i < 8; i++) { xCoords[i] = rotorOffsets[i] * xMagRotor + bladeOffsets[i] * xMagBlade + normalOffsets[i] * xMagNormal; yCoords[i] = rotorOffsets[i] * yMagRotor + bladeOffsets[i] * yMagBlade + normalOffsets[i] * yMagNormal; zCoords[i] = rotorOffsets[i] * zMagRotor + bladeOffsets[i] * zMagBlade + normalOffsets[i] * zMagNormal; } // Calculate UV coords for each face. double[] u = {0D, 0D, 16D, 16D}; double[] v = {0D, 16D, 16D, 0D}; IIcon IIcon = BigReactors.blockTurbineRotorPart.getRotorConnectorIcon(); for(int i = 0; i < 4; i++) { u[i] = IIcon.getInterpolatedU(u[i]); v[i] = IIcon.getInterpolatedV(v[i]); } // Element buffer, which of these do we draw? int[][] quads; if(rotorDir.offsetX != 0 || (bladeDir.offsetX != 0 && rotorDir.offsetY != 0)) { quads = quadSet2; } else { quads = quadSet1; } Tessellator tessellator = Tessellator.instance; tessellator.addTranslation(x, y, z); for(int face = drawOuterRectangle ? 0 : 1; face < quads.length; face++) { for(int vertex = 0; vertex < quads[face].length; vertex++) { int idx = quads[face][vertex]; tessellator.addVertexWithUV(xCoords[idx], yCoords[idx], zCoords[idx], u[vertex], v[vertex]); } } tessellator.addTranslation(-x, -y, -z); renderer.setRenderBounds(0D, 0D, 0D, 1D, 1D, 1D); }
Example 19
Source File: BlockPIMRenderer.java From OpenPeripheral-Addons with MIT License | 4 votes |
private static void setTopPartBounds(RenderBlocks renderer, final boolean hasPlayer) { renderer.setRenderBounds(1.0 / 16.0, 0.3, 1.0 / 16.0, 15.0 / 16.0, hasPlayer? (0.4 - 0.08) : 0.4, 15.0 / 16.0); }
Example 20
Source File: RenderBlockSeat.java From archimedes-ships with MIT License | 4 votes |
@Override public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) { Tessellator tess = Tessellator.instance; GL11.glTranslatef(-0.5F, -0.5F, -0.5F); tess.startDrawingQuads(); tess.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 0)); tess.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 1)); tess.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 5)); tess.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 2)); tess.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 3)); tess.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 4)); tess.draw(); renderer.setRenderBounds(0F, block.getBlockBoundsMaxY(), 0F, 1F, 1F, 0.2F); tess.startDrawingQuads(); tess.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 0)); tess.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 1)); tess.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 5)); tess.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 2)); tess.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 3)); tess.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(block, 4)); tess.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); /* renderer.renderAllFaces = true; renderer.setRenderBounds(0D, 0D, 0D, 1D, 0.5D, 1D); renderer.renderStandardBlock(block, 0, 0, 0); if (meta == 0) { renderer.setRenderBounds(0D, 0D, 0D, 0.2D, 1D, 1D); } else if (meta == 1) { } else if (meta == 2) { renderer.setRenderBounds(0.8D, 0D, 0D, 1D, 1D, 1D); } else if (meta == 3) { } //renderer.renderStandardBlock(block, x, y, z); renderer.renderAllFaces = false; */ }