Just Enough Items (JEI)

Just Enough Items (JEI)

369M Downloads

[Bug]: AE2 support 1.18.2

ixam22 opened this issue ยท 7 comments

commented

Steps to Reproduce the Bug

  1. Open crafting terminal form ae2 and put search mode to JEI Mode
  2. reopen the terminal

Expected Behavior

Jei search bar should be focused

Actual Behavior

Isnt focused, you have to click it first

Mod Pack URL (Optional)

No response

Mod Pack Version (Optional)

No response

Extra Notes (Optional)

No response

latest.log

No response

commented

Thanks for the report!
Please report this issue to AE2, it is up to them to support this behavior with JEI.

commented

@mezz In JEI mode, our search now disappears, and everything uses JEI's own search bar. So it can't be our fault?

commented

The problem also occurs with Refined Storage in their grid.

The problem only occurs with JEI, as soon as you replace it with REI, the problem no longer exists in both Terminal and Grid (AE2 and Refined Storage).

commented

Ok I see. JEI should be able to handle this key input, but it looks like the AE2 search bar remains focused even after you click JEI.
When JEI detects that something else has a focused text entry, it will let that handle key inputs instead of using them itself.

@Technici4n can you help me think through what should happen here when you click the JEI text box? I set the mouse input as handled and cancel the click event (ScreenEvent.MouseClickedEvent.Pre) so I think the click does not reach your GUI.
Maybe could you listen for canceled events and treat them like clicking outside your GUI? Let me know if you have a better idea for how to handle this case.
I think the alternative is that I try to inspect your GUI and force the text field unfocused, but that seems like it will definitely break something.

commented

There is the same issue with the creative menu search. Reproduction: focus the creative menu search, type something, then click the JEI search bar, and notice that characters are still added to the creative menu search bar and not to JEI's. (At least in JEI version 9.7.0.193).

Checking for the cancelled event is quite ugly, and it won't fix the issue in other mods nor in the creative menu. It also won't work on Fabric since there is no such event there yet (and Fabric doesn't allow listening to cancelled events usually).
I think the correct behavior here would indeed be to inspect the GUI and ensure that nothing remains focused. Maybe the following would work if you don't want to inspect all the registered widgets:

if (screen.getFocused() instanceof AbstractWidget widget) {
    widget.setFocused(false);
}
screen.setFocused(null);
commented

Thanks, that sounds like a good solution to me.

commented

This should be working better in the latest versions of JEI for 1.18 and 1.19.
I tested against the vanilla creative menu but I think the solution should be general enough to work for other focused elements from mods. Please let me know if you run into any more issues.