The main issue appears to be, that keys aren't properly updated on death. Vanilla seems to update them if the current screen closes (setScreen(null)), but only if a screen was present (!mouseGrabbed)
MouseHandler#grabMouse, which will be called whenever a Minecraft.setScreen(null) is called, unfortunately as the mouse was still grabbed, because the screen got skipped the function to re-check pressed keys is not called.
How to fix?
I fixed it by calling the KeyMapping.setAll() inside MouseHandler#grabMouse() if the mouseGrabbed is true, that way it's guaranteed to be called. Actually just calling if it is not Minecraft.ON_OSX, ig this bug did not happen on OSX. Dunno if this is a valid approach, but it works (on my machine), may be incompatible with #33
What?
Fixes https://github.com/kennytv/kennytvs-epic-force-close-loading-screen-mod-for-fabric/issues/34.
Where does the issue come from?
The main issue appears to be, that keys aren't properly updated on death. Vanilla seems to update them if the current screen closes (
setScreen(null)
), but only if a screen was present (!mouseGrabbed
)MouseHandler#grabMouse
, which will be called whenever aMinecraft.setScreen(null)
is called, unfortunately as the mouse was still grabbed, because the screen got skipped the function to re-check pressed keys is not called.How to fix?
I fixed it by calling the
KeyMapping.setAll()
insideMouseHandler#grabMouse()
if themouseGrabbed
is true, that way it's guaranteed to be called. Actually just calling if it is notMinecraft.ON_OSX
, ig this bug did not happen on OSX. Dunno if this is a valid approach, but it works (on my machine), may be incompatible with #33