Skip to content

Commit

Permalink
fix some config issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ix0rai committed May 21, 2024
1 parent d637d15 commit c2cf98c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ private void createColourToggles() {
this.options.add(DeferredSaveOption.createDeferredBoolean(
"colour." + colour.getId(),
null,
Rainglow.CONFIG.getCustom().contains(colour),
Rainglow.CONFIG.customColours.getRealValue().contains(colour.getId()),
enabled -> {
if (enabled) {
Rainglow.CONFIG.customColours.value().add(colour.getId());
Rainglow.CONFIG.customColours.getRealValue().add(colour.getId());
}
},
enabled -> this.saveButton.active = true
Expand All @@ -65,7 +65,7 @@ private void createColourToggles() {
}

private void save() {
Rainglow.CONFIG.customColours.value().clear();
Rainglow.CONFIG.customColours.getRealValue().clear();

for (DeferredSaveOption<?> option : this.options) {
option.save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class RainglowConfigScreen extends Screen {
public RainglowConfigScreen(@Nullable Screen parent) {
super(TITLE);
this.parent = parent;
this.mode = RainglowMode.get(Rainglow.CONFIG.mode.value());
this.mode = RainglowMode.get(Rainglow.CONFIG.mode.getRealValue());
this.saveButton = ButtonWidget.builder(Rainglow.translatableText("config.save"), button -> {
this.save();
this.closeScreen(true);
Expand Down Expand Up @@ -109,7 +109,7 @@ private DeferredSaveOption<Boolean> createEntityToggle(RainglowEntity entity) {
return toggles.computeIfAbsent(entity, e -> DeferredSaveOption.createDeferredBoolean(
"config.enable_" + e.getId(),
"tooltip.entity_toggle",
Rainglow.CONFIG.isEntityEnabled(e),
Rainglow.CONFIG.toggles.getRealValue().get(e.getId()),
enabled -> Rainglow.CONFIG.setEntityEnabled(e, enabled),
enabled -> this.saveButton.active = true
));
Expand All @@ -119,7 +119,7 @@ private DeferredSaveOption<Integer> createColourRaritySlider(RainglowEntity enti
return sliders.computeIfAbsent(entity, e -> DeferredSaveOption.createDeferredRangedInt(
"config." + e.getId() + "_rarity",
"tooltip.rarity",
Rainglow.CONFIG.getRarity(e),
Rainglow.CONFIG.rarities.getRealValue().get(e.getId()),
0,
100,
rarity -> Rainglow.CONFIG.setRarity(e, rarity),
Expand Down Expand Up @@ -156,6 +156,7 @@ private void save() {
}

Rainglow.CONFIG.mode.setValue(this.mode.getId());
Rainglow.setMode(RainglowMode.get(this.mode.getId()));
}

private Tooltip createColourListLabel(RainglowMode mode) {
Expand Down

0 comments on commit c2cf98c

Please sign in to comment.