EMI

EMI

1M Downloads

Pressing escape does returns to inventory in certain cases

Gaming32 opened this issue ยท 2 comments

commented

In the case where the current screen is not an HandledScreen when a RecipeScreen is opened, the screen returned to will be the inventory, not the screen returned to. This comes down to RecipeScreen.old being of type HandledScreen and a check occurring to switch to the inventory screen in the case of the current screen not being HandledScreen:

if (getHandledScreen() == null) {
client.setScreen(new InventoryScreen(client.player));
}

public static HandledScreen<?> getHandledScreen() {
Screen s = client.currentScreen;
if (s instanceof HandledScreen<?> hs) {
return hs;
} else if (s instanceof RecipeScreen rs) {
return rs.old;
} else if (s instanceof BoMScreen bs) {
return bs.old;
}
return null;
}

This does not match the behavior of other recipe viewers and causes some less than ideal behavior with my mod, where it returns to the inventory screen instead of the bingo card screen.

commented

This could definitely be improved, that handled screen requirement is, I believe, legacy behavior.

commented

This has been resolved in dev. It will be released along with the 1.20.2 port in the coming days.