HassanS6000 Posted March 2, 2015 Posted March 2, 2015 What I'm trying to do, is that on the press of a key, in this case, Z an overlay appears if you're holding an item. I know everything up until the rendering works. However, when it tries to render, my method for finding the xPos and yPos to start drawing my Rectangle gets screwed up, and goes into negatives, and even when it's not in negatives, it won't render. Here's my code for KeyInputHandler: http://pastebin.com/JNNVSnDu Here's what the numbers are coming up as: Scaled Width: 427 Scaled Height: 240 X-Pos 299 Y-Pos 112 And it doesn't render. Any help would be greatly appreciated! Thanks in Advance Quote
Ernio Posted March 2, 2015 Posted March 2, 2015 Big mistake: (accssing) Proper way: int w = event.resolution.getScaledWidth(); int h = event.resolution.getScaledHeight(); And again - you are doing it wrong. Rendering ANYTHING onto overlay SHOULD happen in GuiRenderGameOverlayEvent. http://www.minecraftforge.net/wiki/Key_Binding After you have you KeyBinding object , you can chk for it's "isPressed" or something like it. Then you can use this variable inside GRGOEvent. Inside that event (overlay), you call code I gave you above. Quote 1.7.10 is no longer supported by forge, you are on your own.
HassanS6000 Posted March 2, 2015 Author Posted March 2, 2015 Thanks! It's working perfectly now! Quote
Recommended Posts
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.