Just Enough Items (JEI)

Just Enough Items (JEI)

392M Downloads

Xaero's Waypoint Creation Causes JEI Crash

Xility-Wil opened this issue ยท 9 comments

commented

Unsure if this is the proper procedure or not, but I feel like the existing issue report for this is lacking in information...

When using default hotkey (B) to create a new waypoint in Xaero's world map, pressing ENTER to complete the creation, causes a crash citing JEI as the cause. Pressing the Confirm button manually with the mouse does not cause this crash.

crash-2021-12-12_17.36.25-client.txt

Heres a video of the exact steps to reproduce:
https://youtu.be/zLE2Yd18trQ

Tested with both NUMpad ENTER and standard ENTER keys, same behavior.

commented

Thanks for the report!
It looks like something is creating this event with a null Screen, which is not allowed:
net.minecraftforge.client.event.ScreenEvent.KeyboardKeyPressedEvent.Post#Post
Please report this issue to Xaero's and link back here.

commented

Hi @thexaero, thanks for hopping in here to clarify!

I originally authored these Forge events, and it was actually never my intention to fire them with a null screen. I just didn't think about this case carefully enough at the time, that's my mistake.
I think to solve this case, when you set the screen to null, you should also cancel the event so that nothing later tries to handle it. That was my original intention for how to use these events, but I never made it very clear.

Right now if you set the screen to null in the Pre event without canceling it, I think the old (dead) screen will still be sent the key press, which is also not intended.

I've I submitted a fix for Forge here that should help clear up the intention of the events: MinecraftForge/MinecraftForge#8296

commented

Pressing the Enter key creates a waypoint and then closes the screen, setting it to null, all within Screen.keyPressed. KeyboardKeyPressedEvent.Post uses the new screen value, which is now null, whether it's intentional or not. JEI will conflict with any screen that closes on key press other than Escape. I think it didn't work like this in 1.17 Forge but here we are. Can be fixed either on your end or Forge, best if both.

commented

@mezz The thing is, I'm not using the Forge events for it, it's all done within a method overriding Screen.keyPressed, which is called between the Pre and Post. So I can't really cancel the event as far as I know.
Your PR should fix everything though, so good job!

commented

@mezz Just realized I can "cancel" the event by returning true, so you are right.

commented

Thanks, I was wondering why this only crashed from your mod and not in vanilla :D
In that case it seems like a simple fix in the waypoint mod, and the forge PR should help as well.

commented

@mezz Yeah, I'll fix it the next chance I get ๐Ÿ˜…

commented

Thanks for the update! Iโ€™ll close this issue.

commented

Alright, this should be fixed on my end now.