Jump to content

[1.7.2] A question regarding a dynamic GUI and occasional crashes on world load.


Recommended Posts

Posted

So I am making a mod that adds functionality to a vanilla item, and I have all portions running except for two parts. First of all, and what is most likely the larger of the two problems is I Want to have a dynamic GUI, meaning depending on what inputs I have the panel showing up displaying information could be located on any place on the screen. I have all data inputs running correctly, but am having trouble getting the actual panel to draw. I am currently using a class that overrides the GuiScreen class's drawScreen method, which tells it to continue on as normal, but first use drawRect (partially just a substitute for whatever I add in latter) with the location to draw at imported from the main logic file of my mod that does most of the computations. Is this correct and I am missing something very trivial that is keeping it from working or am I using a class I shouldn't?

 

The second and not as large problem is that occasionally when loading a world that I have quit previously while holding the item I am adding functionality to, the game will hang and not respond, making me quit, and cheating me out of any error logs. As it only happens while i hold my item on world load and only occasionally, I think it has something to do with the fact that since the logic works per tick, that when the first tick is being run and not all world variables are loading in yet, my logic script is running and trying to access data that doesn't exist yet, for example it detects that the game is in focus and runs a check for the current held item to see if it should run calculations to show the GUI, but the currentitemstack isn't assigned yet. My thoughts are to add a couple ticks delay between world load and first possible run of the script to ensure all variables are loaded in.

 

Just looking for some thoughts on what I should do. This is my first mod, and actually my first time making something in OOP languages, and this is the first thing that has really tripped me up.

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.