/** Renders a dropped item */ private void renderDroppedItem( ArrowEntity arrow, Icon par2Icon, int par3, float par4, float par5, float par6, float par7) { Tessellator tessellator = Tessellator.instance; if (par2Icon == null) { par2Icon = this.renderManager.renderEngine.getMissingIcon( arrow.getEntityItem().getItemSpriteNumber()); } float f4 = par2Icon.getMinU(); float f5 = par2Icon.getMaxU(); float f6 = par2Icon.getMinV(); float f7 = par2Icon.getMaxV(); float f8 = 1.0F; float f9 = 0.5F; float f10 = 0.25F; float f11; GL11.glPushMatrix(); /*float rotation = dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par7; GL11.glRotatef(dagger.rotationYaw + 90, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-rotation * 15, 0.0F, 0.0F, 1.0F);*/ GL11.glRotatef( arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par4 - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef( arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par4 - 45.0F, 0.0F, 0.0F, 1.0F); float f12 = 0.0625F; f11 = 0.021875F; ItemStack itemstack = arrow.getEntityItem(); int j = itemstack.stackSize; byte b0 = getMiniItemCount(itemstack); GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F)); for (int k = 0; k < b0; ++k) { GL11.glTranslatef(0f, 0f, f12 + f11); if (itemstack.getItemSpriteNumber() == 0) { this.loadTexture("/terrain.png"); } else { this.loadTexture("/gui/items.png"); } GL11.glColor4f(par5, par6, par7, 1.0F); ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, par2Icon.getSheetWidth(), par2Icon.getSheetHeight(), f12); if (itemstack != null && itemstack.hasEffect()) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); this.renderManager.renderEngine.bindTexture("%blur%/misc/glint.png"); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f13 = 0.76F; GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f14 = 0.125F; GL11.glScalef(f14, f14, f14); float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f15, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f14, f14, f14); f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f15, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } GL11.glPopMatrix(); }
/** Renders the item stack for being in an entity's hand Args: itemStack */ public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3) { GL11.glPushMatrix(); Block block = null; if (par2ItemStack.getItem() instanceof ItemBlock && par2ItemStack.itemID < Block.blocksList.length) { block = Block.blocksList[par2ItemStack.itemID]; } IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, EQUIPPED); if (customRenderer != null) { this.mc.renderEngine.bindTexture( par2ItemStack.getItemSpriteNumber() == 0 ? "/terrain.png" : "/gui/items.png"); ForgeHooksClient.renderEquippedItem( customRenderer, renderBlocksInstance, par1EntityLiving, par2ItemStack); } else if (block != null && par2ItemStack.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) { this.mc.renderEngine.bindTexture("/terrain.png"); this.renderBlocksInstance.renderBlockAsItem( Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F); } else { Icon icon = par1EntityLiving.getItemIcon(par2ItemStack, par3); if (icon == null) { GL11.glPopMatrix(); return; } if (par2ItemStack.getItemSpriteNumber() == 0) { this.mc.renderEngine.bindTexture("/terrain.png"); } else { this.mc.renderEngine.bindTexture("/gui/items.png"); } Tessellator tessellator = Tessellator.instance; float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); float f4 = 0.0F; float f5 = 0.3F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glTranslatef(-f4, -f5, 0.0F); float f6 = 1.5F; GL11.glScalef(f6, f6, f6); GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); renderItemIn2D( tessellator, f1, f2, f, f3, icon.getSheetWidth(), icon.getSheetHeight(), 0.0625F); if (par2ItemStack != null && par2ItemStack.hasEffect() && par3 == 0) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); this.mc.renderEngine.bindTexture("%blur%/misc/glint.png"); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f7 = 0.76F; GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f8, f8, f8); f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f9, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); } GL11.glPopMatrix(); }