@Override @SideOnly(Side.CLIENT) public void preRender( Entity entity, BodyPart[] parts, BodyPartLocation location, ModelBase model) { RenderBlocks renderBlocks = new RenderBlocks(); ClientProxy.bindTexture(TextureMap.locationItemsTexture); GL11.glEnable(GL11.GL_CULL_FACE); if (location == BodyPartLocation.Torso) { GL11.glPushMatrix(); GL11.glScalef(1.0F, -1.0F, 1.0F); GL11.glTranslatef(0.4F, 0.4F, 0.0F); GL11.glRotatef(42.0F, 0.0F, 1.0F, 0.0F); renderBlocks.renderBlockAsItem(Block.mushroomRed, 0, 1.0F); GL11.glTranslatef(0.1F, 0.0F, -0.4F); GL11.glRotatef(42.0F, 0.0F, 1.0F, 0.0F); renderBlocks.renderBlockAsItem(Block.mushroomRed, 0, 1.0F); GL11.glPopMatrix(); } if (location == BodyPartLocation.Head) { GL11.glPushMatrix(); head[0].postRender(0.0625F); GL11.glScalef(1.0F, -1.0F, 1.0F); GL11.glTranslatef(0.0F, 0.75F, -0.1F); GL11.glRotatef(12.0F, 0.0F, 1.0F, 0.0F); renderBlocks.renderBlockAsItem(Block.mushroomRed, 0, 1.0F); // head GL11.glPopMatrix(); } GL11.glDisable(GL11.GL_CULL_FACE); ClientProxy.bindTexture(texture); }
@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 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 boolean renderWorldBlock( IBlockAccess blockAccess, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) { switch (modelID) { case 90: return renderBlockCrossedSquares(blockAccess, x, y, z, block, modelID, renderer); case 102: return renderer.renderStandardBlock(block, x, y, z); case 103: return renderBlockMetalLadder( blockAccess, x, y, z, (BlockMetalLadder) block, modelID, renderer); case 110: return renderer.renderStandardBlock(block, x, y, z); case 111: return renderBlockWoodLadder( blockAccess, x, y, z, (BlockWoodLadder) block, modelID, renderer); } return false; }
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(); } }
@Override public boolean renderWorldBlock( IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { for (int i = 0; i < _caseBounds.length; i++) { BoundTransform boundTransform = _caseBounds[i]; Bound bound = boundTransform.Bound.copy(); setBound(bound, renderer); renderer.renderStandardBlock(block, x, y, z); if (boundTransform.Transforms == null) continue; for (int j = 0; j < boundTransform.Transforms.length; j++) { PointF p = boundTransform.Transforms[j]; bound.MinX += p.X; bound.MinY += p.Y; bound.MinZ += p.Z; bound.MaxX += p.X; bound.MaxY += p.Y; bound.MaxZ += p.Z; setBound(bound, renderer); renderer.renderStandardBlock(block, x, y, z); ; } } return true; }
@Override public void doRender(Entity var1, double var2, double var4, double var6, float var8, float var9) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_FOG); int age = var1.ticksExisted * 5; float size = 0.5F; // - (age * 0.03F); if (size < 0) size = 0; GL11.glTranslatef((float) var2, (float) var4, (float) var6); this.loadTexture("/terrain.png"); World var11 = var1.worldObj; GL11.glDisable(GL11.GL_LIGHTING); GL11.glRotatef((float) (age * 0.1F * 180.0D / 12.566370964050293D - 0.0D), 1.0F, 0.0F, 0.0F); GL11.glRotatef((float) (age * 0.1F * 180.0D / (Math.PI * 2D) - 0.0D), 0.0F, 1.0F, 0.0F); GL11.glRotatef((float) (age * 0.1F * 180.0D / (Math.PI * 2D) - 0.0D), 0.0F, 0.0F, 1.0F); RenderBlocks rb = new RenderBlocks(var1.worldObj); GL11.glScalef(size, size, size); // Tessellator tess = Tessellator.instance; // tess.setBrightness(255); // tess.setColorOpaque_F(255, 255, 255); // renderBlock = Block.netherrack; rb.setRenderBoundsFromBlock(renderBlock); rb.renderBlockAsItem(renderBlock, 0, 0.8F); GL11.glEnable(GL11.GL_FOG); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
public static void renderRotatingBlockIntoGUI( FontRenderer fontRenderer, RenderEngine renderEngine, ItemStack stack, int x, int y, float zLevel, float scale) { RenderBlocks renderBlocks = new RenderBlocks(); Block block = Block.blocksList[stack.itemID]; renderEngine.bindTexture(renderEngine.getTexture(block.getTextureFile())); GL11.glPushMatrix(); GL11.glTranslatef((float) (x - 2), (float) (y + 3), -3.0F + zLevel); GL11.glScalef(10.0F, 10.0F, 10.0F); GL11.glTranslatef(1.0F, 0.5F, 1.0F); GL11.glScalef(1.0F * scale, 1.0F * scale, -1.0F); GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(0F + 1 * rotationAngle, 0.0F, 1.0F, 0.0F); rotationAngle = (rotationAngle + 1) % 360; int var10 = Item.itemsList[stack.itemID].getColorFromItemStack(stack, 0); float var16 = (float) (var10 >> 16 & 255) / 255.0F; float var12 = (float) (var10 >> 8 & 255) / 255.0F; float var13 = (float) (var10 & 255) / 255.0F; GL11.glColor4f(var16, var12, var13, 1.0F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); renderBlocks.useInventoryTint = true; renderBlocks.renderBlockAsItem(block, stack.getItemDamage(), 1.0F); renderBlocks.useInventoryTint = true; GL11.glPopMatrix(); }
@Override public void renderTileEntityAt(TileEntity t, double x, double y, double z, float pt) { Block blockType = t.getBlockType(); Tessellator tes = Tessellator.instance; tes.setColorOpaque_F(1.0F, 1.0F, 1.0F); renderBlocks.blockAccess = t.getWorldObj(); { if (Minecraft.isAmbientOcclusionEnabled()) { GL11.glShadeModel(GL11.GL_SMOOTH); } else { GL11.glShadeModel(GL11.GL_FLAT); } RenderHelper.disableStandardItemLighting(); RenderUtils.loadTexture(TextureMap.locationBlocksTexture); tes.startDrawingQuads(); tes.setTranslation(x - t.xCoord, y - t.yCoord, z - t.zCoord); renderBlocks.renderBlockAllFaces(blockType, t.xCoord, t.yCoord, t.zCoord); tes.setTranslation(0, 0, 0); tes.draw(); RenderHelper.enableStandardItemLighting(); } }
@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 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 static boolean renderInventoryItem( RenderBlocks renderBlocks, TextureManager engine, ItemStack item, boolean inColor, float zLevel, float x, float y) { IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, INVENTORY); if (customRenderer == null) { return false; } engine.func_110577_a( item.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c); if (customRenderer.shouldUseRenderHelper(INVENTORY, item, INVENTORY_BLOCK)) { GL11.glPushMatrix(); GL11.glTranslatef(x - 2, y + 3, -3.0F + zLevel); GL11.glScalef(10F, 10F, 10F); GL11.glTranslatef(1.0F, 0.5F, 1.0F); GL11.glScalef(1.0F, 1.0F, -1F); GL11.glRotatef(210F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F); if (inColor) { int color = Item.itemsList[item.itemID].getColorFromItemStack(item, 0); float r = (float) (color >> 16 & 0xff) / 255F; float g = (float) (color >> 8 & 0xff) / 255F; float b = (float) (color & 0xff) / 255F; GL11.glColor4f(r, g, b, 1.0F); } GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F); renderBlocks.useInventoryTint = inColor; customRenderer.renderItem(INVENTORY, item, renderBlocks); renderBlocks.useInventoryTint = true; GL11.glPopMatrix(); } else { GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); GL11.glTranslatef(x, y, -3.0F + zLevel); if (inColor) { int color = Item.itemsList[item.itemID].getColorFromItemStack(item, 0); float r = (float) (color >> 16 & 255) / 255.0F; float g = (float) (color >> 8 & 255) / 255.0F; float b = (float) (color & 255) / 255.0F; GL11.glColor4f(r, g, b, 1.0F); } customRenderer.renderItem(INVENTORY, item, renderBlocks); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); } return true; }
private boolean renderWaterOnBasicBlock( RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block) { if (getAdjacentCount(world, x, y, z, Blocks.water) >= 2) { renderer.renderBlockLiquid(Blocks.water, x, y, z); return true; } else if (getAdjacentCount(world, x, y, z, Blocks.flowing_water, Blocks.water) >= 1) { renderer.renderBlockLiquid(Blocks.flowing_water, x, y, z); } return true; }
@Override public boolean renderWorldBlock( IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { int direction = renderer.blockAccess.getBlockMetadata(x, y, z) & 3; if (direction > 0) renderer.uvRotateTop = direction - 1; else renderer.uvRotateTop = 3; boolean flag = renderer.renderStandardBlock(block, x, y, z); renderer.uvRotateTop = 0; return flag; }
@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 renderPassInventory( int pass, BlockBuildCraft block, int meta, RenderBlocks renderer) { if (block.isRotatable()) { renderer.uvRotateTop = Y_ROTATE[block.getFrontSide(meta) - 2]; renderer.uvRotateBottom = Y_ROTATE[block.getFrontSide(meta) - 2]; } RenderUtils.drawBlockItem(renderer, Tessellator.instance, block, meta); renderer.uvRotateTop = 0; renderer.uvRotateBottom = 0; }
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(); }
@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; }
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(); } }
@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(); }
@Override public boolean renderWorldBlock( IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { int metadata = world.getBlockMetadata(x, y, z); if (MachineType.get(block.blockID, metadata) != null) { if (!MachineType.get(block.blockID, metadata).hasModel) { renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBoundsFromBlock(block); return true; } } return false; }
@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 void renderCloud( EntityCloudParachute var1, double var2, double var4, double var6, float var8, float var9) { GL11.glPushMatrix(); if (var1.getRidingHandler().isBeingRidden()) { EntityLiving var10 = var1.getRidingHandler().getRider(); var2 = var10.lastTickPosX + (var10.posX - var10.lastTickPosX) * (double) var9; var4 = var10.lastTickPosY - 1.68D + (var10.posY - var10.lastTickPosY) * (double) var9; var6 = var10.lastTickPosZ + (var10.posZ - var10.lastTickPosZ) * (double) var9; var2 -= RenderManager.renderPosX; var4 -= RenderManager.renderPosY; var6 -= RenderManager.renderPosZ; var8 = (float) ((double) var10.prevRotationYaw + (double) (var10.rotationYaw - var10.prevRotationYaw) * var2); } GL11.glTranslatef((float) var2, (float) var4, (float) var6); GL11.glRotatef(180.0F - var8, 0.0F, 1.0F, 0.0F); this.loadTexture("/net/aetherteam/aether/client/sprites/aetherBlocks.png"); GL11.glEnable(GL11.GL_LIGHTING); renderBlocks.renderBlockAsItem( AetherBlocks.Aercloud, var1.getColor() ? 2 : 0, var1.getBrightness(var9)); GL11.glPopMatrix(); }
@Override public void renderEquippedItems( IRenderAccess renderer, EntityLiving par1EntityLiving, float par2) { ItemStack itemstack = new ItemStack(Block.pumpkin, 1); ModelSnowMan snowmanModel = (ModelSnowMan) renderer.getMainModel(); if (itemstack != null && itemstack.getItem() instanceof ItemBlock) { GL11.glPushMatrix(); snowmanModel.head.postRender(0.0625F); IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED); boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D)); if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) { float f1 = 0.625F; GL11.glTranslatef(0.0F, -0.34375F, 0.0F); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(f1, -f1, f1); } renderer.getRenderManager().itemRenderer.renderItem(par1EntityLiving, itemstack, 0); GL11.glPopMatrix(); } }
@Override public boolean renderWorldBlock( final IBlockAccess world, int x, int y, int z, BlockWorkingProjector block, int modelId, RenderBlocks renderer) { if (ForgeHooksClient.getWorldRenderPass() == 0) { renderer.renderStandardBlock(block, x, y, z); return true; } if (!Config.renderHoloCone) return false; if (ForgeHooksClient.getWorldRenderPass() != 1) return false; // Just in case something breaks final Tessellator tex = Tessellator.instance; tex.addTranslation(x, y + TO_BLOCK_CENTRE, z); if (Config.coneBrightness != BRIGHTNESS_LEVEL_DEF) { tex.setBrightness( Math.max(BRIGHTNESS_LEVEL_MIN, Math.min(Config.coneBrightness, BRIGHTNESS_LEVEL_MAX))); } renderCoreWithTex(block.getIcon(world, x, y, z, -1), tex); tex.addTranslation(-x, -(y + TO_BLOCK_CENTRE), -z); return true; }
public static boolean renderEntityItem( EntityItem entity, ItemStack item, float bobing, float rotation, Random random, TextureManager engine, RenderBlocks renderBlocks) { IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY); if (customRenderer == null) { return false; } if (customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_ROTATION)) { GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F); } if (!customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_BOBBING)) { GL11.glTranslatef(0.0F, -bobing, 0.0F); } boolean is3D = customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D); engine.func_110577_a( item.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c); Block block = (item.itemID < Block.blocksList.length ? Block.blocksList[item.itemID] : null); if (is3D || (block != null && RenderBlocks.renderItemIn3d(block.getRenderType()))) { int renderType = (block != null ? block.getRenderType() : 1); float scale = (renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2 ? 0.5F : 0.25F); if (RenderItem.renderInFrame) { GL11.glScalef(1.25F, 1.25F, 1.25F); GL11.glTranslatef(0.0F, 0.05F, 0.0F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); } GL11.glScalef(scale, scale, scale); int size = item.stackSize; int count = (size > 40 ? 5 : (size > 20 ? 4 : (size > 5 ? 3 : (size > 1 ? 2 : 1)))); for (int j = 0; j < count; j++) { GL11.glPushMatrix(); if (j > 0) { GL11.glTranslatef( ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale, ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale, ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale); } customRenderer.renderItem(ENTITY, item, renderBlocks, entity); GL11.glPopMatrix(); } } else { GL11.glScalef(0.5F, 0.5F, 0.5F); customRenderer.renderItem(ENTITY, item, renderBlocks, entity); } return true; }
@Override public void renderInventoryBlock(Block block, int i, int j, RenderBlocks renderblocks) { block.setBlockBounds( Utils.pipeMinPos, 0.0F, Utils.pipeMinPos, Utils.pipeMaxPos, 1.0F, Utils.pipeMaxPos); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); block.setBlockBounds(0.0F, 0.0F, 0.0F, 1, 4F / 16F, 1); renderblocks.setRenderBoundsFromBlock(block); renderBlockInInv(renderblocks, block, 0); block.setBlockBounds(5F / 16F, 4F / 16F, 5F / 16F, 11F / 16F, 13F / 16F, 11F / 16F); renderblocks.setRenderBoundsFromBlock(block); renderBlockInInv(renderblocks, block, 1); GL11.glTranslatef(0.5F, 0.5F, 0.5F); block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); }
@Override public boolean renderWorldBlock( IBlockAccess world, int x, int y, int z, Block b, int modelId, RenderBlocks rb) { Tessellator v5 = Tessellator.instance; int meta = world.getBlockMetadata(x, y, z); if (renderPass == 0) { int color = b.colorMultiplier(world, x, y, z); float red = ReikaColorAPI.getRed(color) / 255F; float grn = ReikaColorAPI.getGreen(color) / 255F; float blu = ReikaColorAPI.getBlue(color) / 255F; rb.renderStandardBlockWithAmbientOcclusion(b, x, y, z, red, grn, blu); return true; } else if (renderPass == 1) { LightedTreeBlock ltb = (LightedTreeBlock) b; IIcon ico = ltb.getOverlay(meta); v5.setBrightness(240); v5.setColorRGBA_I(0xffffff, b instanceof BlockLeavesBase ? 255 : 220); if (ltb.renderOverlayOnSide(0, meta)) rb.renderFaceYNeg(b, x, y, z, ico); if (ltb.renderOverlayOnSide(1, meta)) rb.renderFaceYPos(b, x, y, z, ico); if (ltb.renderOverlayOnSide(2, meta)) rb.renderFaceZNeg(b, x, y, z, ico); if (ltb.renderOverlayOnSide(3, meta)) rb.renderFaceZPos(b, x, y, z, ico); if (ltb.renderOverlayOnSide(4, meta)) rb.renderFaceXNeg(b, x, y, z, ico); if (ltb.renderOverlayOnSide(5, meta)) rb.renderFaceXPos(b, x, y, z, ico); return true; } return false; }
@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); } }