Remember previous scroll position on config screen
This commit is contained in:
parent
6740857274
commit
77760d7dd2
|
|
@ -13,6 +13,8 @@ public class ModernFixConfigScreen extends Screen {
|
||||||
|
|
||||||
public boolean madeChanges = false;
|
public boolean madeChanges = false;
|
||||||
private Button doneButton, wikiButton;
|
private Button doneButton, wikiButton;
|
||||||
|
private double lastScrollAmount = 0;
|
||||||
|
|
||||||
public ModernFixConfigScreen(Screen lastScreen) {
|
public ModernFixConfigScreen(Screen lastScreen) {
|
||||||
super(new TranslatableComponent("modernfix.config"));
|
super(new TranslatableComponent("modernfix.config"));
|
||||||
this.lastScreen = lastScreen;
|
this.lastScreen = lastScreen;
|
||||||
|
|
@ -21,6 +23,7 @@ public class ModernFixConfigScreen extends Screen {
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
this.optionList = new OptionList(this, this.minecraft);
|
this.optionList = new OptionList(this, this.minecraft);
|
||||||
|
this.optionList.setScrollAmount(lastScrollAmount);
|
||||||
this.children.add(this.optionList);
|
this.children.add(this.optionList);
|
||||||
this.wikiButton = new Button(this.width / 2 - 155, this.height - 29, 150, 20, new TranslatableComponent("modernfix.config.wiki"), (arg) -> {
|
this.wikiButton = new Button(this.width / 2 - 155, this.height - 29, 150, 20, new TranslatableComponent("modernfix.config.wiki"), (arg) -> {
|
||||||
Util.getPlatform().openUri("https://github.com/embeddedt/ModernFix/wiki/Summary-of-Patches");
|
Util.getPlatform().openUri("https://github.com/embeddedt/ModernFix/wiki/Summary-of-Patches");
|
||||||
|
|
@ -50,4 +53,8 @@ public class ModernFixConfigScreen extends Screen {
|
||||||
public void renderComponentHoverEffect(PoseStack matrixStack, @Nullable Style style, int mouseX, int mouseY) {
|
public void renderComponentHoverEffect(PoseStack matrixStack, @Nullable Style style, int mouseX, int mouseY) {
|
||||||
super.renderComponentHoverEffect(matrixStack, style, mouseX, mouseY);
|
super.renderComponentHoverEffect(matrixStack, style, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLastScrollAmount(double d) {
|
||||||
|
this.lastScrollAmount = d;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,7 @@ public class OptionList extends ContainerObjectSelectionList<OptionList.Entry> {
|
||||||
});
|
});
|
||||||
updateStatus();
|
updateStatus();
|
||||||
this.helpButton = new Button(75, 0, 20, 20, new TextComponent("?"), (arg) -> {
|
this.helpButton = new Button(75, 0, 20, 20, new TextComponent("?"), (arg) -> {
|
||||||
|
mainScreen.setLastScrollAmount(getScrollAmount());
|
||||||
Minecraft.getInstance().setScreen(new ModernFixOptionInfoScreen(mainScreen, optionName));
|
Minecraft.getInstance().setScreen(new ModernFixOptionInfoScreen(mainScreen, optionName));
|
||||||
});
|
});
|
||||||
if(!I18n.exists("modernfix.option." + optionName)) {
|
if(!I18n.exists("modernfix.option." + optionName)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user