Jump to content

New Forge Event


BinaryAura

Recommended Posts

I was told by one of the main contributors on github to submit my idea here.

Currently I'm working on a clientside mod. However, due to it's nature, I have to change the ingameGUI. However, the only way that I have found to do this is to use the TickEvent or the RenderTickEvent. Both of which are constantly going off. The reason for this is because there is no Event in between the definition of the ingameGUI and the runGameLoop method. There is an excellent location for such an event to be called in the FML classes: FMLClientHandler$onInitializationComplete  this method is called toward the end of the Minecraft$startgame method after ingameGUI is set. along with many other variables that are set that modders may want to replace in the code.

Link to comment
Share on other sites

Actually flesh out your ideas beyond 'I think thing should go here!' Give reasons, examples of what you're trying to accomplish, let others try and help you achieve it in the way that we already have. In most cases you can do everything you want without any extra hooks anywhere. And if you CANT then people can discuss how best to go about the hooks.

 

So, Moved to Modder Support NOT suggestions, you need to flesh things out.

  • Like 1

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

I'm trying to make a new version of AdvancedHUDMod. Mainly because 1). The original author has handed off the project. 2) Has not been made for 1.8 that I'm aware of. 3) I'm planning to make improvements to the API, 4) I want to make the mod as a whole more flexible, with more options and tools. I call the mod Customize, it can be found here. I wanted to have the mod to be able to allow customization of all ingameGUI objects from chat, to helmet, to portal, to the health, and experience bars. It would create one centralized location where HUD items could report to and allow for player customized layers and modder customized options for each individual options. It also further abstracts this part of the code which, of coarse, is good for module-based code. In order to do this however, because of private methods and methods without API render Flags (e.g. Tooltip, Chat, etc.), I need to replace the ingameGUI method used in the Minecraft class. Since this is a Client Side mod, I can't use Server Side Events such as ServerStarting and I've tried using ClientConnectedToServer, which says it's being launched at the Client yet does nothing. What I want can be done by listening to the TickEvent or RenderTickEvent and changing the ingameGUI then, but only if it isn't already an instance of the new class. However, this new method would needlessly be called every tick (or every other tick in the case of RenderTickEvent). This would slow the code down. Not much in this example, but imagine if there are other things you wanted to do here. ingameGUI is not the only var modders may want to change. If there were other vars, and those vars initiated large loops (honestly, I don't see this, loops should be taken care of during init) then it would slow the code considerably. onInitalizationComlete is an FML class that is called after all the minecraft vars have been assigned and it is before the runGameLoop, so it wouldn't be called multiple times. That's why it would be a good location, either in the method or around the call.

Link to comment
Share on other sites

6 hours ago, diesieben07 said:

You can replace all GUI rendering using RenderGameOverlayEvent, which allows fine-grained control over which elements are rendered and which aren't and also allows you to substitute your own rendering for either the whole HUD or individual elements.

Is there a way to cancel the original HUD via this event?

Edited by BinaryAura
Link to comment
Share on other sites

4 minutes ago, BinaryAura said:

Is there a way to cancel the original HUD via this event?

Yes. the vanilla HUD is made up of multiple elements. Look at the RenderGameOverlayEvent object, and its usages, to see how.

  • Like 1

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.

Link to comment
Share on other sites

Ok, I've been able to use this well for everything except, title/subtitle and record title They are related to the world instead of the player and the fields are protected under ingameGui. Any ideas on how to get this data? title/subtitle is through the packet system and the record seems indirectly called by the jukebox block.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.