Jump to content

[1.16.4] Custom Gui instantly closes [SOLVED]


GloriousAlpaca

Recommended Posts

50 minutes ago, GloriousAlpaca said:

Maybe but I kinda like the ObjectHolder, do you think it has anything to do with the bug?
What are you supposed to use Objectholders for?

oh, actually it's probably because you're passing the wrong player to the isWithinUsableDistance method

 

Edit: this also doesn't solve the problem, but in the ContainerScreen class you don't need to draw the container and player inventory titles to the screen, the method in the super class already does that, so you would be writing it twice

Edited by kiou.23
Link to comment
Share on other sites

10 hours ago, kiou.23 said:

oh, actually it's probably because you're passing the wrong player to the isWithinUsableDistance method

 

Edit: this also doesn't solve the problem, but in the ContainerScreen class you don't need to draw the container and player inventory titles to the screen, the method in the super class already does that, so you would be writing it twice

Thank you I removed them and edited the player.

 

14 minutes ago, diesieben07 said:

You open the container for the tank controller block. The container then checks, that a tank block exists at its position. It of course never does, because you open the GUI for the tank controller position - so the container instantly closes.

I'm not sure if I understand correctly, but the Tank Controller Block extends the Tank Block, so shouldn't it still work?

Regardless I have changed the Block to the Tank Controller and it works now.
Thank you for your help!

Edited by GloriousAlpaca
Link to comment
Share on other sites

Just now, diesieben07 said:

Inheritance is not involved here. You are using isWithinUsableDistance which checks for a specific block.

Ahhh okay thanks!
The gui is working now (except for the player Slots which are shifted up a little).
I am trying to make a multiblock and I'm just opening the gui on the position of the controller when I activate the slaveblocks, do you think that will lead to bugs within the isWithinUsableDistance method?

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.