Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.20 Inventory Controls feature failures #67

Closed
boholder opened this issue Jul 2, 2023 · 1 comment
Closed

1.20 Inventory Controls feature failures #67

boholder opened this issue Jul 2, 2023 · 1 comment

Comments

@boholder
Copy link
Member

boholder commented Jul 2, 2023

Can not deselect/unfocus Text fields with Enter key.

Unlike description in here, it WORKS in my env: survival mode, press E to open inventory screen, then press T to focus on input field, then press Enter to deselect.

It can't work on CreativeInventoryScreen and AnvilScreen, can work on InventoryScreen and CraftingScreen.

Why it can't work:

When the Enter key is pressed, the this.focusUnlocked condition at TextFieldWidget.setFocused() is false, so it will skip the rest of the logic. How to properly invoking setFocusUnlocked()? I'm not sure for now.

Can not enter characters if you directly press the T to focus on search box in recipe book once open inventory controls menu.

Here is the reason: When any key is pressed while a screen is opening, the code inside ParentElement is triggered by keyboard listener.

default boolean keyPressed(int keyCode, int scanCode, int modifiers) {
        return this.getFocused() != null && this.getFocused().keyPressed(keyCode, scanCode, modifiers);
}

And the this.getFocused() will return null.

Set a break point on TextFieldWidget.setFocused() and check the logic when clicking on the search box to make it focused, we'll know that after InventoryScreen.mouseClicked():150, there is another this.setFocused(this.recipeBook);. That's what our manually invoking has missed.

I suggest that we can simulate a mouse click for T key.

boholder referenced this issue in boholder/minecraft-access Jul 5, 2023
@boholder boholder closed this as completed Jul 5, 2023
@boholder
Copy link
Member Author

boholder commented Jul 5, 2023

Solved by #73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant