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 renderItem(ItemRenderType type, ItemStack item, Object... data) { RenderBlocks renderer = (RenderBlocks) data[0]; int metadata = item.getItemDamage(); GL11.glPushMatrix(); renderer.setOverrideBlockTexture(PillarMaterials.values()[metadata].block.getIcon(0, 0)); Tessellator tessellator = Tessellator.instance; renderer.setRenderBoundsFromBlock(this.bl); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(this.bl, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(this.bl, 0)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(this.bl, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSide(this.bl, 0)); tessellator.draw(); renderer.clearOverrideBlockTexture(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glPushMatrix(); GL11.glRotatef(180, 0F, 1F, 0F); Minecraft.getMinecraft().renderEngine.bindTexture(this.textureFrame); this.modelFrame.renderAll(); GL11.glPopMatrix(); GL11.glPopMatrix(); }
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 void renderToInventory(ItemStack item, RenderBlocks renderBlocks) { Block block = PainterUtil.getSourceBlock(item); if (block != null) { renderBlocks.setOverrideBlockTexture( renderBlocks.getBlockIconFromSideAndMetadata(block, 2, item.getItemDamage())); } renderBlocks.renderBlockAsItem(Block.blocksList[item.itemID], item.getItemDamage(), 1.0f); renderBlocks.clearOverrideBlockTexture(); }
public void renderEquipped(ItemStack item, RenderBlocks renderBlocks) { Block block = PainterUtil.getSourceBlock(item); if (block != null) { renderBlocks.setOverrideBlockTexture( renderBlocks.getBlockIconFromSideAndMetadata(block, 2, item.getItemDamage())); } GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); renderBlocks.renderBlockAsItem(Block.blocksList[item.itemID], item.getItemDamage(), 1.0f); GL11.glPopMatrix(); renderBlocks.clearOverrideBlockTexture(); }
private void renderBlock(RenderBlocks renderer, Block content, int color, int x, int y, int z) { if (renderer.overrideBlockTexture == null) { renderer.setOverrideBlockTexture(Textures.White_BG); renderer.renderStandardBlockWithColorMultiplier( content, x, y, z, (color >> 16 & 255) / 255.0F, (color >> 8 & 255) / 255.0F, (color & 255) / 255.0F); renderer.clearOverrideBlockTexture(); } }
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) { int ID = block.blockID; int meta = world.getBlockMetadata(x, y, z); if (meta > 8) meta = 8; this.boxIcon = Block.planks.getIcon(0, 0); this.contentsIcon = DCsAppleMilk.bowlBlock.getIcon(0, meta); if (modelId == this.getRenderId()) { // box renderer.setOverrideBlockTexture(this.boxIcon); block.setBlockBounds( 6.0F / 16.0F, 0.0F / 16.0F, 6.0F / 16.0F, 10.0F / 16.0F, 1.0F / 16.0F, 10.0F / 16.0F); renderer.setRenderBoundsFromBlock(block); renderer.renderStandardBlock(block, x, y, z); renderer.setOverrideBlockTexture(this.boxIcon); block.setBlockBounds( 4.0F / 16.0F, 1.0F / 16.0F, 4.0F / 16.0F, 12.0F / 16.0F, 2.0F / 16.0F, 12.0F / 16.0F); renderer.setRenderBoundsFromBlock(block); renderer.renderStandardBlock(block, x, y, z); // contents if (meta == 0 || meta == 4) { renderer.setOverrideBlockTexture(this.contentsIcon); block.setBlockBounds( 4.0F / 16.0F, 2.0F / 16.0F, 4.0F / 16.0F, 12.0F / 16.0F, 7.0F / 16.0F, 12.0F / 16.0F); renderer.setRenderBoundsFromBlock(block); renderer.renderStandardBlock(block, x, y, z); renderer.setOverrideBlockTexture(this.contentsIcon); block.setBlockBounds( 5.0F / 16.0F, 7.0F / 16.0F, 5.0F / 16.0F, 11.0F / 16.0F, 8.0F / 16.0F, 11.0F / 16.0F); renderer.setRenderBoundsFromBlock(block); renderer.renderStandardBlock(block, x, y, z); } else if (meta < 8) { renderer.setOverrideBlockTexture(this.contentsIcon); block.setBlockBounds( 4.0F / 16.0F, 2.0F / 16.0F, 4.0F / 16.0F, 12.0F / 16.0F, 4.0F / 16.0F, 12.0F / 16.0F); renderer.setRenderBoundsFromBlock(block); renderer.renderStandardBlock(block, x, y, z); } renderer.setOverrideBlockTexture(this.boxIcon); block.setBlockBounds( 3.0F / 16.0F, 2.0F / 16.0F, 3.0F / 16.0F, 13.0F / 16.0F, 5.0F / 16.0F, 4.0F / 16.0F); renderer.setRenderBoundsFromBlock(block); renderer.renderStandardBlock(block, x, y, z); renderer.setOverrideBlockTexture(this.boxIcon); block.setBlockBounds( 3.0F / 16.0F, 2.0F / 16.0F, 12.0F / 16.0F, 13.0F / 16.0F, 5.0F / 16.0F, 13.0F / 16.0F); renderer.setRenderBoundsFromBlock(block); renderer.renderStandardBlock(block, x, y, z); renderer.setOverrideBlockTexture(this.boxIcon); block.setBlockBounds( 3.0F / 16.0F, 2.0F / 16.0F, 4.0F / 16.0F, 4.0F / 16.0F, 5.0F / 16.0F, 12.0F / 16.0F); renderer.setRenderBoundsFromBlock(block); renderer.renderStandardBlock(block, x, y, z); renderer.setOverrideBlockTexture(this.boxIcon); block.setBlockBounds( 12.0F / 16.0F, 2.0F / 16.0F, 4.0F / 16.0F, 13.0F / 16.0F, 5.0F / 16.0F, 12.0F / 16.0F); renderer.setRenderBoundsFromBlock(block); renderer.renderStandardBlock(block, x, y, z); renderer.clearOverrideBlockTexture(); block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); renderer.setRenderBoundsFromBlock(block); return true; } return false; }
@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 par2, int par3, int par4, Block par1Block, int modelId, RenderBlocks renderer) { if (modelId == model) { int l = renderer.blockAccess.getBlockMetadata(par2, par3, par4); int i1 = l & 7; boolean flag = (l & 8) > 0; Tessellator tessellator = Tessellator.instance; boolean flag1 = renderer.hasOverrideBlockTexture(); if (!flag1) { renderer.setOverrideBlockTexture(renderer.getBlockIcon(Block.netherrack)); } float f = 0.25F; float f1 = 0.1875F; float f2 = 0.1875F; if (i1 == 5) { renderer.setRenderBounds( (double) (0.5F - f1), 0.0D, (double) (0.5F - f), (double) (0.5F + f1), (double) f2, (double) (0.5F + f)); } else if (i1 == 6) { renderer.setRenderBounds( (double) (0.5F - f), 0.0D, (double) (0.5F - f1), (double) (0.5F + f), (double) f2, (double) (0.5F + f1)); } else if (i1 == 4) { renderer.setRenderBounds( (double) (0.5F - f1), (double) (0.5F - f), (double) (1.0F - f2), (double) (0.5F + f1), (double) (0.5F + f), 1.0D); } else if (i1 == 3) { renderer.setRenderBounds( (double) (0.5F - f1), (double) (0.5F - f), 0.0D, (double) (0.5F + f1), (double) (0.5F + f), (double) f2); } else if (i1 == 2) { renderer.setRenderBounds( (double) (1.0F - f2), (double) (0.5F - f), (double) (0.5F - f1), 1.0D, (double) (0.5F + f), (double) (0.5F + f1)); } else if (i1 == 1) { renderer.setRenderBounds( 0.0D, (double) (0.5F - f), (double) (0.5F - f1), (double) f2, (double) (0.5F + f), (double) (0.5F + f1)); } else if (i1 == 0) { renderer.setRenderBounds( (double) (0.5F - f), (double) (1.0F - f2), (double) (0.5F - f1), (double) (0.5F + f), 1.0D, (double) (0.5F + f1)); } else if (i1 == 7) { renderer.setRenderBounds( (double) (0.5F - f1), (double) (1.0F - f2), (double) (0.5F - f), (double) (0.5F + f1), 1.0D, (double) (0.5F + f)); } renderer.renderStandardBlock(par1Block, par2, par3, par4); if (!flag1) { renderer.clearOverrideBlockTexture(); } tessellator.setBrightness( par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4)); float f3 = 1.0F; if (Block.lightValue[par1Block.blockID] > 0) { f3 = 1.0F; } tessellator.setColorOpaque_F(f3, f3, f3); Icon icon = renderer.getBlockIconFromSide(par1Block, 0); if (renderer.hasOverrideBlockTexture()) { icon = renderer.overrideBlockTexture; } double d0 = (double) icon.getMinU(); double d1 = (double) icon.getMinV(); double d2 = (double) icon.getMaxU(); double d3 = (double) icon.getMaxV(); Vec3[] avec3 = new Vec3[8]; float f4 = 0.0625F; float f5 = 0.0625F; float f6 = 0.625F; avec3[0] = renderer .blockAccess .getWorldVec3Pool() .getVecFromPool((double) (-f4), 0.0D, (double) (-f5)); avec3[1] = renderer.blockAccess.getWorldVec3Pool().getVecFromPool((double) f4, 0.0D, (double) (-f5)); avec3[2] = renderer.blockAccess.getWorldVec3Pool().getVecFromPool((double) f4, 0.0D, (double) f5); avec3[3] = renderer.blockAccess.getWorldVec3Pool().getVecFromPool((double) (-f4), 0.0D, (double) f5); avec3[4] = renderer .blockAccess .getWorldVec3Pool() .getVecFromPool((double) (-f4), (double) f6, (double) (-f5)); avec3[5] = renderer .blockAccess .getWorldVec3Pool() .getVecFromPool((double) f4, (double) f6, (double) (-f5)); avec3[6] = renderer .blockAccess .getWorldVec3Pool() .getVecFromPool((double) f4, (double) f6, (double) f5); avec3[7] = renderer .blockAccess .getWorldVec3Pool() .getVecFromPool((double) (-f4), (double) f6, (double) f5); for (int j1 = 0; j1 < 8; ++j1) { if (flag) { avec3[j1].zCoord -= 0.0625D; avec3[j1].rotateAroundX(((float) Math.PI * 2F / 9F)); } else { avec3[j1].zCoord += 0.0625D; avec3[j1].rotateAroundX(-((float) Math.PI * 2F / 9F)); } if (i1 == 0 || i1 == 7) { avec3[j1].rotateAroundZ((float) Math.PI); } if (i1 == 6 || i1 == 0) { avec3[j1].rotateAroundY(((float) Math.PI / 2F)); } if (i1 > 0 && i1 < 5) { avec3[j1].yCoord -= 0.375D; avec3[j1].rotateAroundX(((float) Math.PI / 2F)); if (i1 == 4) { avec3[j1].rotateAroundY(0.0F); } if (i1 == 3) { avec3[j1].rotateAroundY((float) Math.PI); } if (i1 == 2) { avec3[j1].rotateAroundY(((float) Math.PI / 2F)); } if (i1 == 1) { avec3[j1].rotateAroundY(-((float) Math.PI / 2F)); } avec3[j1].xCoord += (double) par2 + 0.5D; avec3[j1].yCoord += (double) ((float) par3 + 0.5F); avec3[j1].zCoord += (double) par4 + 0.5D; } else if (i1 != 0 && i1 != 7) { avec3[j1].xCoord += (double) par2 + 0.5D; avec3[j1].yCoord += (double) ((float) par3 + 0.125F); avec3[j1].zCoord += (double) par4 + 0.5D; } else { avec3[j1].xCoord += (double) par2 + 0.5D; avec3[j1].yCoord += (double) ((float) par3 + 0.875F); avec3[j1].zCoord += (double) par4 + 0.5D; } } Vec3 vec3 = null; Vec3 vec31 = null; Vec3 vec32 = null; Vec3 vec33 = null; for (int k1 = 0; k1 < 6; ++k1) { if (k1 == 0) { d0 = (double) icon.getInterpolatedU(7.0D); d1 = (double) icon.getInterpolatedV(6.0D); d2 = (double) icon.getInterpolatedU(9.0D); d3 = (double) icon.getInterpolatedV(8.0D); } else if (k1 == 2) { d0 = (double) icon.getInterpolatedU(7.0D); d1 = (double) icon.getInterpolatedV(6.0D); d2 = (double) icon.getInterpolatedU(9.0D); d3 = (double) icon.getMaxV(); } if (k1 == 0) { vec3 = avec3[0]; vec31 = avec3[1]; vec32 = avec3[2]; vec33 = avec3[3]; } else if (k1 == 1) { vec3 = avec3[7]; vec31 = avec3[6]; vec32 = avec3[5]; vec33 = avec3[4]; } else if (k1 == 2) { vec3 = avec3[1]; vec31 = avec3[0]; vec32 = avec3[4]; vec33 = avec3[5]; } else if (k1 == 3) { vec3 = avec3[2]; vec31 = avec3[1]; vec32 = avec3[5]; vec33 = avec3[6]; } else if (k1 == 4) { vec3 = avec3[3]; vec31 = avec3[2]; vec32 = avec3[6]; vec33 = avec3[7]; } else if (k1 == 5) { vec3 = avec3[0]; vec31 = avec3[3]; vec32 = avec3[7]; vec33 = avec3[4]; } tessellator.addVertexWithUV(vec3.xCoord, vec3.yCoord, vec3.zCoord, d0, d3); tessellator.addVertexWithUV(vec31.xCoord, vec31.yCoord, vec31.zCoord, d2, d3); tessellator.addVertexWithUV(vec32.xCoord, vec32.yCoord, vec32.zCoord, d2, d1); tessellator.addVertexWithUV(vec33.xCoord, vec33.yCoord, vec33.zCoord, d0, d1); } } return true; }