fix: profile configuration being overwritten

This commit is contained in:
axolotlmaid 2024-09-14 21:58:51 +01:00
parent 8843ee8a53
commit 531e64fda2
2 changed files with 3 additions and 3 deletions

View file

@ -70,7 +70,7 @@ public class EditProfileScreen extends Screen {
linearLayoutButtons.addChild( linearLayoutButtons.addChild(
Button.builder( Button.builder(
Component.translatable("gui.optionsprofiles.options-toggle").append("..."), 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) .size(150, 20)
.tooltip(Tooltip.create(Component.translatable("gui.optionsprofiles.options-toggle.tooltip"))) .tooltip(Tooltip.create(Component.translatable("gui.optionsprofiles.options-toggle.tooltip")))
.build(), .build(),

View file

@ -14,10 +14,10 @@ public class OptionsToggleScreen extends OptionsSubScreen {
private OptionsToggleList optionsToggleList; private OptionsToggleList optionsToggleList;
public ProfileConfiguration profileConfiguration; 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())); super(lastScreen, null, Component.literal(Component.translatable("gui.optionsprofiles.options-toggle").append(": ").getString() + profileName.getString()));
this.profileName = profileName; this.profileName = profileName;
this.profileConfiguration = ProfileConfiguration.get(profileName.getString()); this.profileConfiguration = profileConfiguration;
} }
protected void addOptions() {} protected void addOptions() {}