neoforged / NeoForge

Neo Modding API for Minecraft, based on Forge
https://projects.neoforged.net/neoforged/neoforge
Other
1.13k stars 165 forks source link

[1.20.4] Unable to cancel deleting a world #406

Closed Andromander closed 8 months ago

Andromander commented 8 months ago

Minecraft Version: 1.20.4

NeoForge Version: 20.4.46-beta

Logs: latest.log

Steps to Reproduce:

  1. Find a world to delete
  2. On the world deletion screen, have a change of heart and cancel it

Description of issue: When clicking on the Cancel button, the screen does not progress back to world selection. The button remains highlighted even after clicking and can still be clicked but with no response.

sciwhiz12 commented 8 months ago

Confirmed on https://github.com/neoforged/NeoForge/commit/97f3373426889234d5327de88f7fd635571f0119 (development environment).

It seems the fix implemented in #95 considered the case of the deletion being agreed to but failed to consider the case of the deletion being canceled.

In the first case, the screen would be ProgressScreen (as set in the if-branch a few lines up), and the fix works as intended. However, in the second case, the screen will remain as ConfirmScreen; as the patched-in if-condition requires the screen to be ProgressScreen to switch back to the selection screen, the screen is never switched back.

The fix is simple: check if the current screen is either ProgressScreen (deletion successful, with more than one world remaining) or ConfirmScreen (deletion canceled). In the case that the deletion is successful and no worlds remain, the CreateWorldScreen set from within doDeleteWorld() remains in place.