Posted December 14, 20168 yr Hello there, So I'm having issues with rendering over the game with a texture, however, I cannot figure out how to draw the texture, this , for example didnt work : @SubscribeEvent public static void onRenderGameOverlay(RenderGameOverlayEvent event) { final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_mana_bar"); Minecraft mc = Minecraft.getMinecraft(); if(!event.isCanceled() && event.getType() == RenderGameOverlayEvent.ElementType.TEXT) { CapabilityManaData storage = mc.thePlayer.getCapability(CapabilityMagic.MANA, null); mc.renderEngine.bindTexture(RES_LOC); mc.ingameGUI.drawTexturedModalRect(mc.displayWidth / 2, mc.displayHeight / 2, 0, 0, 111, 9); } } Thanks, Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
December 14, 20168 yr Why do people keep checking event.isCancelable() ? That's only ever going to return true or false based on the event class and won't ever change. Are you mistaking it for event.isCanceled() ? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 14, 20168 yr Author Ah, yeah I think so. However, it still wont render. Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
December 14, 20168 yr I don't see anything obvious, but it's been a while since I tried to render any GUI stuff. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 14, 20168 yr Author Yeah, Just figured it out, the mc.displayHeight/Width, seemed to return null? So I set it to a static value and it displays now... Thanks regardless. Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
December 14, 20168 yr Author Actually, It seems that setting static values, doesnt scale with the screen. So maximizing =! minimizing. Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
December 14, 20168 yr With the event you're using you can use "event.getResolution();" which is a ScaledResolution object. from there you can create a middle X, far X, middle Y, and lowest Y ScaledResolution res = event.getResolution(); int bottomScreen = res.getScaledHeight(), halfHeight = bottomScreen / 2; int rightScreen = res.getScaledWidth(), halfWidth = rightScreen / 2; then you can just draw what you want based off of that. And screen size (the game window size) and GUI Scale (Video Setting) Currently updating my Mod to 1.10.2 https://bitbucket.org/hugo_the_dwarf/riseoftristram2016/src?at=master
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.