Posted March 19, 201510 yr It seems my RenderGameOverlayEvent isn't rendering, I basically just wanna render a string once the player enters the game: @SubscribeEvent public void onOverlayRender(RenderGameOverlayEvent.Post event) { FMLClientHandler.instance().getClient().fontRenderer.drawStringWithShadow("Yooooooo", 0, 0, 16777215); } It should be working, but it doesn't, hmm.
March 19, 201510 yr Author Registered it with: FMLCommonHandler.instance().bus().register(new ModEventHandler()); Check the element type? I'm a bit new to the minecraft source, can you give me a quick dirty rundown on that? I'm running 1.7.10 btw.
March 19, 201510 yr Author That worked thanks a ton! How would i go about updating it when I need to/every tick? Its going to display my armor weight value.
March 20, 201510 yr You are probably missing the idea. This event is called everytime for each overlay phase (HEALTH, CHAT, FOOD, etc.) on every tick frame. You just need to put your code in one of phases. The armour for your player can be pulled from mc.thePlayer.inventory.(...) (something with main and armour inventory and [.0],[1],[2],[3]) i belive your armour weight is saved inside NBT? You simply access it and draw. 1.7.10 is no longer supported by forge, you are on your own.
March 20, 201510 yr Author This is what i have under the Render event: FMLClientHandler.instance().getClient().fontRenderer.drawStringWithShadow(String.format("%.2f", weight), 0, 0, 16777215); NOW, its my understanding i need to only render at a certain phase, because currently it does not display the value of weight, which is for sure being set because my debug shows it! So something not right, whats the setupup for a phase, i know so far its "event.getPhase() == something" but im not sure about the something! Any tips or links to lead me in the right direction?
March 20, 201510 yr Author So how do check the phase? is it just Phase.START? When i use: if(event.type == RenderGameOverlayEvent.ElementType.EXPERIENCE) It just replaced the experience bar...
March 20, 201510 yr Author Hmm, it still won't update at all in game... public class ModEventHandler { public float weight; @SubscribeEvent public void onEntityUpdate(PlayerTickEvent event) { weight = ModArmor.armorCall(event.player); event.player.capabilities.setPlayerWalkSpeed(weight); System.out.println((ModArmor.armorCall(event.player))); } @SubscribeEvent public void onOverlayRender(RenderGameOverlayEvent event) { if (event.type == RenderGameOverlayEvent.ElementType.ALL) { FMLClientHandler.instance().getClient().fontRenderer.drawStringWithShadow(String.format("%.2f", weight), 0, 0,16777215); } } } Edit: Nvm i got it working!
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.