Skip to content

Commit

Permalink
Make ModMenu Cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
MystWraith committed Dec 20, 2023
1 parent 8ac2762 commit b5d2f79
Showing 1 changed file with 56 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,27 +154,31 @@ public void createItemConfig(YetAnotherConfigLib.@NotNull Builder builder) {
);
}

public void createCCTConfig(YetAnotherConfigLib.@NotNull Builder builder) {
public void createTimerConfig(YetAnotherConfigLib.@NotNull Builder builder) {

builder.category(ConfigCategory.createBuilder()
.name(Text.literal("Chest Cooldown Timer"))
.option(Option.<Boolean>createBuilder()
.name(Text.literal("Enabled"))
.binding(true, () -> Options.getInstance().cctconfig.enabled, e -> Options.getInstance().cctconfig.enabled = e)
.controller(BooleanControllerBuilder::create)
.build()
)
.option(Option.<Boolean>createBuilder()
.name(Text.literal("Play Sound When Chest Ready"))
.binding(false, () -> Options.getInstance().cctconfig.soundEnabled, e -> Options.getInstance().cctconfig.soundEnabled = e)
.controller(BooleanControllerBuilder::create)
.build()
)
.option(Option.<Boolean>createBuilder()
.name(Text.literal("Function Outside Pickaxe"))
.binding(false, () -> Options.getInstance().cctconfig.enabledOutsidePickaxe, e -> Options.getInstance().cctconfig.enabledOutsidePickaxe = e)
.controller(BooleanControllerBuilder::create)
.build()
)
.name(Text.literal("Timers"))

.group(OptionGroup.createBuilder()
.name(Text.literal("Chest Cooldown Timer"))
.option(Option.<Boolean>createBuilder()
.name(Text.literal("Enabled"))
.binding(true, () -> Options.getInstance().cctconfig.enabled, e -> Options.getInstance().cctconfig.enabled = e)
.controller(BooleanControllerBuilder::create)
.build()
)
.option(Option.<Boolean>createBuilder()
.name(Text.literal("Play Sound When Chest Ready"))
.binding(false, () -> Options.getInstance().cctconfig.soundEnabled, e -> Options.getInstance().cctconfig.soundEnabled = e)
.controller(BooleanControllerBuilder::create)
.build()
)
.option(Option.<Boolean>createBuilder()
.name(Text.literal("Function Outside Pickaxe"))
.binding(false, () -> Options.getInstance().cctconfig.enabledOutsidePickaxe, e -> Options.getInstance().cctconfig.enabledOutsidePickaxe = e)
.controller(BooleanControllerBuilder::create)
.build()
)
.option(Option.<TimerLocation>createBuilder()
.name(Text.literal("CCT Location"))
.binding(TimerLocation.TOPRIGHT, () -> Options.getInstance().cctconfig.location, e -> Options.getInstance().cctconfig.location = e)
Expand All @@ -184,39 +188,45 @@ public void createCCTConfig(YetAnotherConfigLib.@NotNull Builder builder) {

.build()
)

.build()
);
}

public void createMDTConfig(YetAnotherConfigLib.@NotNull Builder builder) {
builder.category(ConfigCategory.createBuilder()
.name(Text.literal("Moon Door Timer"))
.option(Option.<Boolean>createBuilder()
.name(Text.literal("Enabled"))
.binding(true, () -> Options.getInstance().mdtConfig.enabled, e -> Options.getInstance().mdtConfig.enabled = e)
.controller(BooleanControllerBuilder::create)
.build()
)
.option(Option.<Boolean>createBuilder()
.name(Text.literal("Play Sound When Door Ready"))
.binding(false, () -> Options.getInstance().mdtConfig.soundEnabled, e -> Options.getInstance().mdtConfig.soundEnabled = e)
.controller(BooleanControllerBuilder::create)
.build()
)
.option(Option.<TimerLocation>createBuilder()
.name(Text.literal("MDT Location"))
.binding(TimerLocation.TOPRIGHT, () -> Options.getInstance().mdtConfig.location, e -> Options.getInstance().mdtConfig.location = e)
.controller((opt) -> EnumControllerBuilder.create(opt)
.enumClass(TimerLocation.class)

.group(OptionGroup.createBuilder()
.name(Text.literal("Moon Door Timer"))
.option(Option.<Boolean>createBuilder()
.name(Text.literal("Enabled"))
.binding(true, () -> Options.getInstance().mdtConfig.enabled, e -> Options.getInstance().mdtConfig.enabled = e)
.controller(BooleanControllerBuilder::create)
.build()
)
.option(Option.<Boolean>createBuilder()
.name(Text.literal("Play Sound When Door Ready"))
.binding(false, () -> Options.getInstance().mdtConfig.soundEnabled, e -> Options.getInstance().mdtConfig.soundEnabled = e)
.controller(BooleanControllerBuilder::create)
.build()
)
.option(Option.<TimerLocation>createBuilder()
.name(Text.literal("MDT Location"))
.binding(TimerLocation.TOPRIGHT, () -> Options.getInstance().mdtConfig.location, e -> Options.getInstance().mdtConfig.location = e)
.controller((opt) -> EnumControllerBuilder.create(opt)
.enumClass(TimerLocation.class)
)

.build()
)
.build()
)

.option(Option.<Boolean>createBuilder()
.name(Text.literal("Swap MDT and CCT"))
.name(Text.literal("Order"))
.binding(false, () -> Options.getInstance().mdtConfig.reverseCCTOrder, e -> Options.getInstance().mdtConfig.reverseCCTOrder = e)
.controller(BooleanControllerBuilder::create)
.controller((opt) -> BooleanControllerBuilder.create(opt)
.formatValue((state) ->
state
? Text.literal("MDT on top")
: Text.literal("CCT on top")
)
)
.build()
)

Expand Down Expand Up @@ -278,8 +288,7 @@ public Screen getConfigScreen(Screen parent) {

createGeneralScreen(builder);
createItemConfig(builder);
createCCTConfig(builder);
createMDTConfig(builder);
createTimerConfig(builder);
createPOIConfig(builder);
createMessageStackingConfig(builder, parent);

Expand Down

0 comments on commit b5d2f79

Please sign in to comment.