Skip to content

Commit

Permalink
use that classic intellij format style
Browse files Browse the repository at this point in the history
  • Loading branch information
orifu committed Jun 5, 2024
1 parent e0b706a commit 621e97c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 49 deletions.
18 changes: 9 additions & 9 deletions src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ protected void save() {
protected void method_60325() {
for (RainglowColour colour : RainglowColour.values()) {
this.options.add(DeferredSaveOption.createDeferredBoolean(
"colour." + colour.getId(),
null,
Rainglow.CONFIG.customColours.getRealValue().contains(colour.getId()),
enabled -> {
if (enabled) {
Rainglow.CONFIG.customColours.getRealValue().add(colour.getId());
}
},
enabled -> this.saveButton.active = true
"colour." + colour.getId(),
null,
Rainglow.CONFIG.customColours.getRealValue().contains(colour.getId()),
enabled -> {
if (enabled) {
Rainglow.CONFIG.customColours.getRealValue().add(colour.getId());
}
},
enabled -> this.saveButton.active = true
));
}

Expand Down
62 changes: 31 additions & 31 deletions src/main/java/io/ix0rai/rainglow/config/RainglowConfigScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,52 +87,52 @@ protected void method_60325() {

contentLayout.add(gridWidget);
contentLayout.add(ButtonWidget.builder(
Rainglow.translatableText("config.custom"),
button -> MinecraftClient.getInstance().setScreen(new CustomModeScreen(this))
).width(308).position(4, 0).build(),
LayoutSettings.create().setPadding(4, 0));
Rainglow.translatableText("config.custom"),
button -> MinecraftClient.getInstance().setScreen(new CustomModeScreen(this))
).width(308).position(4, 0).build(),
LayoutSettings.create().setPadding(4, 0));

this.field_49503.addToContents(contentLayout);
}

private DeferredSaveOption<Boolean> createEntityToggle(RainglowEntity entity) {
return DeferredSaveOption.createDeferredBoolean(
"config.enable_" + entity.getId(),
"tooltip.entity_toggle",
Rainglow.CONFIG.toggles.getRealValue().get(entity.getId()),
enabled -> Rainglow.CONFIG.toggles.getRealValue().put(entity.getId(), enabled),
enabled -> this.saveButton.active = true
"config.enable_" + entity.getId(),
"tooltip.entity_toggle",
Rainglow.CONFIG.toggles.getRealValue().get(entity.getId()),
enabled -> Rainglow.CONFIG.toggles.getRealValue().put(entity.getId(), enabled),
enabled -> this.saveButton.active = true
);
}

private DeferredSaveOption<Integer> createColourRaritySlider(RainglowEntity entity) {
return DeferredSaveOption.createDeferredRangedInt(
"config." + entity.getId() + "_rarity",
"tooltip.rarity",
Rainglow.CONFIG.rarities.getRealValue().get(entity.getId()),
0,
100,
rarity -> Rainglow.CONFIG.rarities.getRealValue().put(entity.getId(), rarity),
rarity -> this.saveButton.active = true
);
"config." + entity.getId() + "_rarity",
"tooltip.rarity",
Rainglow.CONFIG.rarities.getRealValue().get(entity.getId()),
0,
100,
rarity -> Rainglow.CONFIG.rarities.getRealValue().put(entity.getId(), rarity),
rarity -> this.saveButton.active = true
);
}

public CyclingButtonWidget<RainglowMode> createModeButton() {
return CyclingButtonWidget.builder(RainglowMode::getText)
.values(RainglowMode.values())
.initially(this.mode)
.tooltip(this::createColourListLabel)
.build(
0,
0,
308,
20,
Rainglow.translatableText("config.mode"),
(cyclingButtonWidget, mode) -> {
this.saveButton.active = true;
this.mode = mode;
}
);
.values(RainglowMode.values())
.initially(this.mode)
.tooltip(this::createColourListLabel)
.build(
0,
0,
308,
20,
Rainglow.translatableText("config.mode"),
(cyclingButtonWidget, mode) -> {
this.saveButton.active = true;
this.mode = mode;
}
);
}

private Tooltip createColourListLabel(RainglowMode mode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public SaveableGameOptionsScreen(Screen parent, Text title) {
super(parent, MinecraftClient.getInstance().options, title);

this.saveButton = ButtonWidget.builder(
Rainglow.translatableText("config.save"),
button -> {
if (this.validate()) {
this.save();
}
}).build();
Rainglow.translatableText("config.save"),
button -> {
if (this.validate()) {
this.save();
}
}).build();
this.saveButton.active = false;
}

Expand Down Expand Up @@ -74,9 +74,10 @@ protected void init() {
contentWidget.add(new TextWidget(Rainglow.translatableText("config.unsaved_warning"), this.textRenderer), LayoutSettings::alignHorizontallyCenter);

LinearLayoutWidget buttons = new LinearLayoutWidget(250, 20, LinearLayoutWidget.Orientation.HORIZONTAL).setSpacing(8);
buttons.add(ButtonWidget.builder(Rainglow.translatableText("config.continue_editing"), (buttonWidget) -> {
MinecraftClient.getInstance().setScreen(SaveableGameOptionsScreen.this);
}).build());
buttons.add(ButtonWidget.builder(
Rainglow.translatableText("config.continue_editing"),
(buttonWidget) -> MinecraftClient.getInstance().setScreen(SaveableGameOptionsScreen.this)
).build());
buttons.add(ButtonWidget.builder(CommonTexts.YES, (buttonWidget) -> MinecraftClient.getInstance().setScreen(parent)).build());

contentWidget.add(buttons, LayoutSettings::alignHorizontallyCenter);
Expand Down

0 comments on commit 621e97c

Please sign in to comment.