Posted February 28, 201510 yr What I want to do, is that when a player is wearing a helmet, a overlay is rendered similar to that of the Halo HUD. However, when trying to render anything, it throws errors which seem to be caused from when I bind the texture. Any help would be appreciated! Thanks in Advance! My Armor Code: http://pastebin.com/AtMZ4wxb The Log: http://tny.cz/810eb7a4
February 28, 201510 yr You are doing it wrong. Use RenderGameOverlayEvent, get mc.thePlayer, check for helmet and if is instanceof then render something. http://www.minecraftforge.net/wiki/Gui_Overlay 1.7.10 is no longer supported by forge, you are on your own.
February 28, 201510 yr How can I be more specific? I gave you link to tutorial that gives perfect example on how to use this event. To be more informative I can add: Tick != FPS Ticks are 20/sec and are used to update game data, while lwjgl works alone just using that data. You can't draw stuff inside ticking methods (like you did there). You need to use RenderGameOverlayEvent and draw your stuff there. That event gives you access to overlay screen and width/height of it. 1.7.10 is no longer supported by forge, you are on your own.
March 1, 201510 yr Author Okay! I've got some things working but not completely! First off, I was wondering how I would scale the image so it always fits the full screen. Currently it's just set to the size of the image, and if the screen size is larger than the image, the image begins to repeat itself. Here's my code for Event Handler: http://pastebin.com/FxWwCmvh Here are my screenshots: http://snag.gy/NESzb.jpg http://snag.gy/pwiPC.jpg ALSO! When I try to check if the armor (Helmet) is equipped (currently the commented out code), the game crashes. Here's my crash report: http://pastebin.com/UDCu6pV3 Any help would be greatly appreciated! Thanks!
March 1, 201510 yr ScaledResolution Scaled = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); this.drawNonStandardTexturedRect(xPos, yPos, 0, 0, mc.displayWidth, mc.displayHeight, 420, 250); You have a variable for a scaled resolution, yet you don't use it. Use this: ScaledResolution Scaled = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); this.drawNonStandardTexturedRect(xPos, yPos, 0, 0, Scaled.getScaledWidth(), Scaled.getScaledHeight(), 420, 250); //if (((EntityPlayer)mc.thePlayer).inventory.armorInventory[3].getItem() == halocraft.Main.SpartanHelmet){ Check if inventory.armorInventory[3] != null first
March 1, 201510 yr "ALSO! When I try to check if the armor (Helmet) is equipped (currently the commented out code), the game crashes." - Solution is to first take given slot (slots are ItemStacks array) and check if itemStack != null. Only after that you can get item from non-null ItemStack. Resizing will be simply HARD. If you'd accomplish it in any way, the results will be different on different clients and it might affect how your e.g map (bottom left) is displayed. I suggest auto-aligning image to center and smooth-transition to dark on corners if size is exceeded. In this case - have look at how vanilla renders viantage or how the close-to-worldd-border effect is being done (the red-shading on borders of screen). 1.7.10 is no longer supported by forge, you are on your own.
March 1, 201510 yr Author Alright, thanks for your help I would rather have the image just stop if I can't make it fit to the screen.
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.