Posted July 10, 201312 yr Heyo! I've experimented a bit with events and rendering and decided to tap into the RenderGameOverlayEvent so render an arrow counter for my custom bow. It works by displaying the icon of the arrow over the icon of the bow and is only displayed when the bow is selected. However, when I select the bow, the text in chat and the text displaying what item was selected darkens. I believe that it has something to do with disabling and enabling various GL11 options, but I have been unable to figure out which. The code is as folows: public void render(RenderGameOverlayEvent event) { if(event.isCancelable() || event.type != ElementType.HOTBAR) { return; } ScaledResolution rez = event.resolution; int xPos = 2; int yPos = 2; EntityPlayer player = this.mc.thePlayer; if(player.getCurrentEquippedItem()!=null&&player.getCurrentEquippedItem().itemID==BluTechnology.ItemStandardBow.itemID) { GL11.glPushMatrix(); RenderHelper.enableGUIStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int meta = player.getCurrentEquippedItem().getItemDamage(); //Ignore the method getArrows(), it simply returns an integer of how many arrows of the type are in the inventory of the player ItemStack ammo = new ItemStack(BluTechnology.ItemArrowparts,getArrows(player,meta),meta+1); int hbStart = ((rez.getScaledWidth()/2)-91); itemRenderer.zLevel = 100.0F; itemRenderer.renderItemAndEffectIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, ammo, (player.inventory.currentItem*20)+hbStart+3, rez.getScaledHeight()-54); itemRenderer.renderItemOverlayIntoGUI(this.mc.fontRenderer, this.mc.renderEngine, ammo, (player.inventory.currentItem*20)+hbStart+6, rez.getScaledHeight()-55); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_COLOR_MATERIAL); RenderHelper.enableStandardItemLighting(); } } Anyone see what I'm going for and what I'm doing wrong?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.