fix: optionsToLoad config resetting
This commit is contained in:
parent
24cb7d665d
commit
05c49ad582
3 changed files with 8 additions and 8 deletions
|
|
@ -68,7 +68,7 @@ public class EditProfileScreen extends Screen {
|
|||
linearLayoutButtons.addChild(
|
||||
Button.builder(
|
||||
Component.translatable("gui.optionsprofiles.options-toggle").append("..."),
|
||||
(button) -> this.minecraft.setScreen(new OptionsToggleScreen(this, profileName)))
|
||||
(button) -> this.minecraft.setScreen(new OptionsToggleScreen(this, profileName, profileConfiguration)))
|
||||
.size(150, 20)
|
||||
.pos(this.width / 2 - 75, 187)
|
||||
.tooltip(Tooltip.create(Component.translatable("gui.optionsprofiles.options-toggle.tooltip")))
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ public class OptionsToggleList extends ContainerObjectSelectionList<OptionsToggl
|
|||
private final String profileName;
|
||||
private final ProfileConfiguration profileConfiguration;
|
||||
|
||||
public OptionsToggleList(OptionsToggleScreen optionsToggleScreen, Minecraft minecraft, String profileName) {
|
||||
public OptionsToggleList(OptionsToggleScreen optionsToggleScreen, Minecraft minecraft, String profileName, ProfileConfiguration profileConfiguration) {
|
||||
super(minecraft, optionsToggleScreen.width, optionsToggleScreen.layout.getContentHeight(), optionsToggleScreen.layout.getHeaderHeight(), 20);
|
||||
this.profileConfiguration = optionsToggleScreen.profileConfiguration;
|
||||
this.profileConfiguration = profileConfiguration;
|
||||
this.profileName = profileName;
|
||||
|
||||
refreshEntries(false, false);
|
||||
|
|
|
|||
|
|
@ -11,20 +11,20 @@ import net.minecraft.network.chat.Component;
|
|||
|
||||
public class OptionsToggleScreen extends OptionsSubScreen {
|
||||
private final Component profileName;
|
||||
private final ProfileConfiguration profileConfiguration;
|
||||
private OptionsToggleList optionsToggleList;
|
||||
public ProfileConfiguration profileConfiguration;
|
||||
|
||||
protected OptionsToggleScreen(Screen lastScreen, Component profileName) {
|
||||
protected OptionsToggleScreen(Screen lastScreen, Component profileName, ProfileConfiguration profileConfiguration) {
|
||||
super(lastScreen, null, Component.literal(Component.translatable("gui.optionsprofiles.options-toggle").append(": ").getString() + profileName.getString()));
|
||||
this.profileName = profileName;
|
||||
this.profileConfiguration = ProfileConfiguration.get(profileName.getString());
|
||||
this.profileConfiguration = profileConfiguration;
|
||||
}
|
||||
|
||||
protected void addOptions() {}
|
||||
|
||||
protected void addContents() {
|
||||
this.layout.setHeaderHeight(24);
|
||||
this.optionsToggleList = this.layout.addToContents(new OptionsToggleList(this, this.minecraft, profileName.getString()));
|
||||
this.optionsToggleList = this.layout.addToContents(new OptionsToggleList(this, this.minecraft, profileName.getString(), this.profileConfiguration));
|
||||
}
|
||||
|
||||
protected void addFooter() {
|
||||
|
|
@ -55,7 +55,7 @@ public class OptionsToggleScreen extends OptionsSubScreen {
|
|||
}
|
||||
|
||||
public void removed() {
|
||||
profileConfiguration.save();
|
||||
this.profileConfiguration.save();
|
||||
}
|
||||
|
||||
protected void repositionElements() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue