Posted December 18, 20204 yr Hello, I can't seem to figure out why my gui instantly closes after I open it. This is my code: Block Container Screen/Gui Registry Main Mod Class (Where I register the Screen) Thank you for your help! Edited December 19, 20204 yr by GloriousAlpaca
December 18, 20204 yr you don't need a block holder you can get any object from the registry by calling RegistryObject#get()
December 18, 20204 yr Author 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?
December 18, 20204 yr 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 December 19, 20204 yr by kiou.23
December 19, 20204 yr Author 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 December 19, 20204 yr by GloriousAlpaca
December 19, 20204 yr Author 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?
December 19, 20204 yr Author Just now, diesieben07 said: You don't have to use that method. You're right I'll just do a custom check. I'll mark this as solved. Thank you for your replies!
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.