Fix ModListScreen escape key not matching done button behavior. Closes #6672

This commit is contained in:
Jamie Mansfield 2020-05-06 21:41:43 +01:00 committed by GitHub
parent a7e4cdcc49
commit 766019e1fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 5 deletions

View File

@ -98,7 +98,7 @@ public class ModListScreen extends Screen
private static final int PADDING = 6;
private Screen mainMenu;
private Screen parentScreen;
private ModListWidget modList;
private InfoPanel modInfo;
@ -118,12 +118,12 @@ public class ModListScreen extends Screen
private SortType sortType = SortType.NORMAL;
/**
* @param mainMenu
* @param parentScreen
*/
public ModListScreen(Screen mainMenu)
public ModListScreen(Screen parentScreen)
{
super(new TranslationTextComponent("fml.menu.mods.title"));
this.mainMenu = mainMenu;
this.parentScreen = parentScreen;
this.mods = Collections.unmodifiableList(ModList.get().getMods());
this.unsortedMods = Collections.unmodifiableList(this.mods);
}
@ -279,7 +279,7 @@ public class ModListScreen extends Screen
int doneButtonWidth = Math.min(modInfoWidth, 200);
int y = this.height - 20 - PADDING;
this.addButton(new Button(((listWidth + PADDING + this.width - doneButtonWidth) / 2), y, doneButtonWidth, 20,
I18n.format("gui.done"), b -> ModListScreen.this.minecraft.displayGuiScreen(ModListScreen.this.mainMenu)));
I18n.format("gui.done"), b -> ModListScreen.this.onClose()));
this.addButton(this.openModsFolderButton = new Button(6, y, this.listWidth, 20,
I18n.format("fml.menu.mods.openmodsfolder"), b -> Util.getOSType().openFile(FMLPaths.MODSDIR.get().toFile())));
y -= 20 + PADDING;
@ -501,4 +501,10 @@ public class ModListScreen extends Screen
resortMods(sort);
updateCache();
}
@Override
public void onClose()
{
this.minecraft.displayGuiScreen(this.parentScreen);
}
}