use of com.redlimerl.speedrunigt.gui.screen.SpeedRunCategoryScreen in project SpeedRunIGT by RedLime.
the class OptionButtonsImpl method createOptionButtons.
@Override
public Collection<OptionButtonFactory> createOptionButtons() {
ArrayList<OptionButtonFactory> factories = new ArrayList<>();
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.timer_position"), (ButtonWidget button) -> MinecraftClient.getInstance().openScreen(new TimerCustomizeScreen(screen)))).setCategory("speedrunigt.option.category.general"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.timer_category"), (ButtonWidget button) -> MinecraftClient.getInstance().openScreen(new SpeedRunCategoryScreen(screen)))).setCategory("speedrunigt.option.category.general"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.check_info"), (ButtonWidget button) -> MinecraftClient.getInstance().openScreen(new SpeedRunIGTInfoScreen(screen)))).setCategory("speedrunigt.option.category.general"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.reload"), (ButtonWidget button) -> MinecraftClient.getInstance().openScreen(new ConfirmScreen(boolean1 -> {
if (boolean1) {
SpeedRunOption.reload();
}
MinecraftClient.getInstance().openScreen(screen);
}, new TranslatableText("speedrunigt.message.reload_options"), LiteralText.EMPTY)))).setCategory("speedrunigt.option.category.general"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.global_options").append(" : ").append(SpeedRunOption.isUsingGlobalConfig() ? ScreenTexts.ON : ScreenTexts.OFF), (ButtonWidget button) -> {
SpeedRunOption.setUseGlobalConfig(!SpeedRunOption.isUsingGlobalConfig());
MinecraftClient.getInstance().openScreen(new ConfirmScreen(boolean1 -> {
if (boolean1) {
SpeedRunOption.reload();
}
MinecraftClient.getInstance().openScreen(screen);
}, new TranslatableText("speedrunigt.message.reload_options"), LiteralText.EMPTY));
})).setToolTip(() -> I18n.translate("speedrunigt.option.global_options.description", SpeedRunOption.getConfigPath())).setCategory("speedrunigt.option.category.general"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.timer_position.toggle_timer").append(" : ").append(TIMER_DRAWER.isToggle() ? ScreenTexts.ON : ScreenTexts.OFF), (ButtonWidget button) -> {
TIMER_DRAWER.setToggle(!TIMER_DRAWER.isToggle());
SpeedRunOption.setOption(SpeedRunOptions.TOGGLE_TIMER, TIMER_DRAWER.isToggle());
button.setMessage(new TranslatableText("speedrunigt.option.timer_position.toggle_timer").append(" : ").append(TIMER_DRAWER.isToggle() ? ScreenTexts.ON : ScreenTexts.OFF));
})).setCategory("speedrunigt.option.category.timer"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.hide_timer_in_options").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.HIDE_TIMER_IN_OPTIONS) ? ScreenTexts.ON : ScreenTexts.OFF), (ButtonWidget button) -> {
SpeedRunOption.setOption(SpeedRunOptions.HIDE_TIMER_IN_OPTIONS, !SpeedRunOption.getOption(SpeedRunOptions.HIDE_TIMER_IN_OPTIONS));
button.setMessage(new TranslatableText("speedrunigt.option.hide_timer_in_options").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.HIDE_TIMER_IN_OPTIONS) ? ScreenTexts.ON : ScreenTexts.OFF));
})).setCategory("speedrunigt.option.category.timer"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.hide_timer_in_debugs").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.HIDE_TIMER_IN_DEBUGS) ? ScreenTexts.ON : ScreenTexts.OFF), (ButtonWidget button) -> {
SpeedRunOption.setOption(SpeedRunOptions.HIDE_TIMER_IN_DEBUGS, !SpeedRunOption.getOption(SpeedRunOptions.HIDE_TIMER_IN_DEBUGS));
button.setMessage(new TranslatableText("speedrunigt.option.hide_timer_in_debugs").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.HIDE_TIMER_IN_DEBUGS) ? ScreenTexts.ON : ScreenTexts.OFF));
})).setCategory("speedrunigt.option.category.timer"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.waiting_first_input").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.WAITING_FIRST_INPUT) ? ScreenTexts.ON : ScreenTexts.OFF), (ButtonWidget button) -> {
SpeedRunOption.setOption(SpeedRunOptions.WAITING_FIRST_INPUT, !SpeedRunOption.getOption(SpeedRunOptions.WAITING_FIRST_INPUT));
button.setMessage(new TranslatableText("speedrunigt.option.waiting_first_input").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.WAITING_FIRST_INPUT) ? ScreenTexts.ON : ScreenTexts.OFF));
})).setToolTip(() -> I18n.translate("speedrunigt.option.waiting_first_input.description")).setCategory("speedrunigt.option.category.timing"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.auto_toggle_coop").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.AUTOMATIC_COOP_MODE) ? ScreenTexts.ON : ScreenTexts.OFF), (ButtonWidget button) -> {
SpeedRunOption.setOption(SpeedRunOptions.AUTOMATIC_COOP_MODE, !SpeedRunOption.getOption(SpeedRunOptions.AUTOMATIC_COOP_MODE));
button.setMessage(new TranslatableText("speedrunigt.option.auto_toggle_coop").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.AUTOMATIC_COOP_MODE) ? ScreenTexts.ON : ScreenTexts.OFF));
})).setToolTip(() -> I18n.translate("speedrunigt.option.auto_toggle_coop.description")).setCategory("speedrunigt.option.category.timer"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.start_old_worlds").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.TIMER_START_GENERATED_WORLD) ? ScreenTexts.ON : ScreenTexts.OFF), (ButtonWidget button) -> {
SpeedRunOption.setOption(SpeedRunOptions.TIMER_START_GENERATED_WORLD, !SpeedRunOption.getOption(SpeedRunOptions.TIMER_START_GENERATED_WORLD));
button.setMessage(new TranslatableText("speedrunigt.option.start_old_worlds").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.TIMER_START_GENERATED_WORLD) ? ScreenTexts.ON : ScreenTexts.OFF));
})).setToolTip(() -> I18n.translate("speedrunigt.option.start_old_worlds.description")).setCategory("speedrunigt.option.category.timing"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.limitless_reset").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.TIMER_LIMITLESS_RESET) ? ScreenTexts.ON : ScreenTexts.OFF), (ButtonWidget button) -> {
SpeedRunOption.setOption(SpeedRunOptions.TIMER_LIMITLESS_RESET, !SpeedRunOption.getOption(SpeedRunOptions.TIMER_LIMITLESS_RESET));
button.setMessage(new TranslatableText("speedrunigt.option.limitless_reset").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.TIMER_LIMITLESS_RESET) ? ScreenTexts.ON : ScreenTexts.OFF));
})).setToolTip(() -> I18n.translate("speedrunigt.option.limitless_reset.description")).setCategory("speedrunigt.option.category.timing"));
if (Math.random() < 0.1) {
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new LiteralText("amongus"), (ButtonWidget button) -> {
})).setCategory("sus"));
}
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.current_extensions"), (ButtonWidget button) -> {
})).setToolTip(() -> {
StringBuilder extension = new StringBuilder(I18n.translate("speedrunigt.option.current_extensions.description", SpeedRunIGTApi.getProviders().length));
extension.append("\n");
int auto = 0;
for (ModContainer provider : SpeedRunIGTApi.getProviders()) {
if (auto++ > 4) {
auto = 0;
extension.append("\n");
}
extension.append(String.format("%s v%s,", provider.getMetadata().getName(), provider.getMetadata().getVersion()));
}
return extension.substring(0, extension.length() - 1);
}).setCategory("speedrunigt.option.category.general"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.legacy_igt_mode").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.TIMER_LEGACY_IGT_MODE) ? ScreenTexts.ON : ScreenTexts.OFF), (ButtonWidget button) -> {
SpeedRunOption.setOption(SpeedRunOptions.TIMER_LEGACY_IGT_MODE, !SpeedRunOption.getOption(SpeedRunOptions.TIMER_LEGACY_IGT_MODE));
button.setMessage(new TranslatableText("speedrunigt.option.legacy_igt_mode").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.TIMER_LEGACY_IGT_MODE) ? ScreenTexts.ON : ScreenTexts.OFF));
})).setToolTip(() -> I18n.translate("speedrunigt.option.legacy_igt_mode.description")).setCategory("speedrunigt.option.category.timer"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.auto_save_interval").append(" : ").append(new TranslatableText("speedrunigt.option.auto_save_interval." + SpeedRunOption.getOption(SpeedRunOptions.TIMER_DATA_AUTO_SAVE).name().toLowerCase(Locale.ROOT))), (ButtonWidget button) -> {
int order = SpeedRunOption.getOption(SpeedRunOptions.TIMER_DATA_AUTO_SAVE).ordinal() + 1;
SpeedRunOptions.TimerSaveInterval[] intervals = SpeedRunOptions.TimerSaveInterval.values();
SpeedRunOption.setOption(SpeedRunOptions.TIMER_DATA_AUTO_SAVE, intervals[order % intervals.length]);
button.setMessage(new TranslatableText("speedrunigt.option.auto_save_interval").append(" : ").append(new TranslatableText("speedrunigt.option.auto_save_interval." + SpeedRunOption.getOption(SpeedRunOptions.TIMER_DATA_AUTO_SAVE).name().toLowerCase(Locale.ROOT))));
})).setToolTip(() -> I18n.translate("speedrunigt.option.auto_save_interval.description")).setCategory("speedrunigt.option.category.timer"));
factories.add(screen -> new OptionButtonFactory.Builder().setButtonWidget(new ButtonWidget(0, 0, 150, 20, new TranslatableText("speedrunigt.option.auto_retime").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.AUTO_RETIME_FOR_GUIDELINE) ? ScreenTexts.ON : ScreenTexts.OFF), (ButtonWidget button) -> {
SpeedRunOption.setOption(SpeedRunOptions.AUTO_RETIME_FOR_GUIDELINE, !SpeedRunOption.getOption(SpeedRunOptions.AUTO_RETIME_FOR_GUIDELINE));
button.setMessage(new TranslatableText("speedrunigt.option.auto_retime").append(" : ").append(SpeedRunOption.getOption(SpeedRunOptions.AUTO_RETIME_FOR_GUIDELINE) ? ScreenTexts.ON : ScreenTexts.OFF));
})).setToolTip(() -> I18n.translate("speedrunigt.option.auto_retime.description")).setCategory("speedrunigt.option.category.timer"));
return factories;
}
Aggregations