Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

The GuiGameOver screen is fired a second time on the OpenGuiEvent when the respawn button is pressed which is causing me serious problems. I've investigated the problem and it seems to stem from Minecraft's displayGuiScreen method which displays this screen if the player is below 0 hp. I don't know how vanilla isn't affected by this, but my own replacement GUI which is mostly copied from the GuiGameOver is displayed again after the respawn button is clicked.

I tried copying the displayGuiScreen method and removing the part which opens the GuiGameOver and using it in my GUI, but that didn't change anything. I have no idea why this is happening.

Edited by Melonslise

12 hours ago, Melonslise said:

1. The GuiGameOver screen is fired a second time on the OpenGuiEvent when the respawn button is pressed which is causing me serious problems. I've investigated the problem and it seems to stem from Minecraft's displayGuiScreen method which displays this screen if the player is below 0 hp.

 

You're right that the code is a bit convoluted. You'll notice that it only checks for < 0 health if the guiScreenIn parameter is null. It seems that the screen passed in is null when "escaping" from some GUIs and so then this section of code will check if the death GUI should be shown. I guess they do this instead of going back to the parent GUI (the normal thing you do when exiting a GUI) because there is a chance that you died while you had the other inventory up on the screen. 

 

The Minecraft#displayGuiScreen() method with GuiGameOver is also called from the NetHandlerPlayClient when it receives a SPacketCombatEvent for ENTITY_DIED in the case where the entity is the player.

 

So I suppose there could be a "race" condition that causes the event to fire twice -- once when client decides player health is < 0 and also when it receives packet from server notifying of the death. However, it is not clear to me that this would happen after pressing the respawn button.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

  • Author
55 minutes ago, jabelar said:

You're right that the code is a bit convoluted. You'll notice that it only checks for < 0 health if the guiScreenIn parameter is null. It seems that the screen passed in is null when "escaping" from some GUIs and so then this section of code will check if the death GUI should be shown. I guess they do this instead of going back to the parent GUI (the normal thing you do when exiting a GUI) because there is a chance that you died while you had the other inventory up on the screen. 

 

The Minecraft#displayGuiScreen() method with GuiGameOver is also called from the NetHandlerPlayClient when it receives a SPacketCombatEvent for ENTITY_DIED in the case where the entity is the player.

 

So I suppose there could be a "race" condition that causes the event to fire twice -- once when client decides player health is < 0 and also when it receives packet from server notifying of the death. However, it is not clear to me that this would happen after pressing the respawn button.

I thought that the reason was that the displayGuiScreen method was called from the respawn button. As I said, I tried writing my own version of the method and added it to the respawn button, however that didn't change anything. I urgently need to figure out how to fix this issue.

EDIT: Also I noticed that none of these bugs happen to the vanilla GUI. Even when you have a different screen open when you die. I don't understand why this happens to my custom gui only.

Edited by Melonslise

  • Author

Ok I managed to fix the problem by closing the GUI if the player's health is higher than 0 in the the GUI's update method. It's a bit hacky, but it's the best I could come up with.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.