use of me.flashyreese.mods.sodiumextra.client.gui.options.control.SliderControlExtended in project sodium-extra-fabric by FlashyReese.
the class SodiumExtraGameOptionPages method render.
public static OptionPage render() {
List<OptionGroup> groups = new ArrayList<>();
groups.add(OptionGroup.createBuilder().add(OptionImpl.createBuilder(int.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.fog")).setTooltip(new TranslatableText("sodium-extra.option.fog.tooltip")).setControl(option -> new SliderControlExtended(option, 0, 33, 1, ControlValueFormatterExtended.fogDistance(), false)).setBinding((options, value) -> options.renderSettings.fogDistance = value, options -> options.renderSettings.fogDistance).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("sodium-extra.option.light_updates")).setTooltip(new TranslatableText("sodium-extra.option.light_updates.tooltip")).setControl(TickBoxControl::new).setBinding((options, value) -> options.renderSettings.lightUpdates = value, options -> options.renderSettings.lightUpdates).build()).build());
groups.add(OptionGroup.createBuilder().add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("entity.minecraft.item_frame")).setTooltip(new TranslatableText("sodium-extra.option.item_frames.tooltip")).setControl(TickBoxControl::new).setBinding((opts, value) -> opts.renderSettings.itemFrame = value, opts -> opts.renderSettings.itemFrame).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("entity.minecraft.armor_stand")).setTooltip(new TranslatableText("sodium-extra.option.armor_stands.tooltip")).setControl(TickBoxControl::new).setBinding((options, value) -> options.renderSettings.armorStand = value, options -> options.renderSettings.armorStand).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("entity.minecraft.painting")).setTooltip(new TranslatableText("sodium-extra.option.paintings.tooltip")).setControl(TickBoxControl::new).setBinding((options, value) -> options.renderSettings.painting = value, options -> options.renderSettings.painting).setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD).build()).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts).setName(new TranslatableText("block.minecraft.piston")).setTooltip(new TranslatableText("sodium-extra.option.piston.tooltip")).setControl(TickBoxControl::new).setBinding((options, value) -> options.renderSettings.piston = value, options -> options.renderSettings.piston).build()).build());
return new OptionPage(new TranslatableText("sodium-extra.option.render"), ImmutableList.copyOf(groups));
}
use of me.flashyreese.mods.sodiumextra.client.gui.options.control.SliderControlExtended in project sodium-extra-fabric by FlashyReese.
the class MixinSodiumGameOptionPages method general.
@Inject(method = "general", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/gui/options/OptionGroup;createBuilder()Lme/jellysquid/mods/sodium/client/gui/options/OptionGroup$Builder;", ordinal = 1, shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILSOFT, remap = false)
private static void general(CallbackInfoReturnable<OptionPage> cir, List<OptionGroup> groups) {
Window window = MinecraftClient.getInstance().getWindow();
groups.add(OptionGroup.createBuilder().add(OptionImpl.createBuilder(int.class, vanillaOpts).setName(new TranslatableText("options.fullscreen.resolution")).setTooltip(new TranslatableText("sodium-extra.option.resolution.tooltip")).setControl(option -> new SliderControlExtended(option, 0, window.getMonitor() != null ? window.getMonitor().getVideoModeCount() : 0, 1, ControlValueFormatterExtended.resolution(), false)).setBinding((options, value) -> {
if (window.getMonitor() != null) {
if (value == 0) {
window.setVideoMode(Optional.empty());
} else {
window.setVideoMode(Optional.of(window.getMonitor().getVideoMode(value - 1)));
}
}
}, options -> {
if (window.getMonitor() == null) {
return 0;
} else {
Optional<VideoMode> optional = window.getVideoMode();
return optional.map((videoMode) -> window.getMonitor().findClosestVideoModeIndex(videoMode) + 1).orElse(0);
}
}).setFlags(OptionFlag.REQUIRES_GAME_RESTART).setImpact(OptionImpact.HIGH).build()).build());
}
Aggregations