Search in sources :

Example 1 with OptionImpl

use of me.jellysquid.mods.sodium.client.gui.options.OptionImpl in project Iris by IrisShaders.

the class IrisSodiumOptions method createMaxShadowDistanceSlider.

public static OptionImpl<Options, Integer> createMaxShadowDistanceSlider(MinecraftOptionsStorage vanillaOpts) {
    OptionImpl<Options, Integer> maxShadowDistanceSlider = OptionImpl.createBuilder(int.class, vanillaOpts).setName("Max Shadow Distance").setTooltip("The shadow render distance controls how far away terrain can potentially be rendered in the shadow pass. Lower distances mean that less terrain will be " + "rendered, improving frame rates. This option cannot be changed on packs which explicitly specify a shadow render distance. The actual shadow render distance is capped by the " + "View Distance setting.").setControl(option -> new SliderControl(option, 0, 32, 1, ControlValueFormatter.quantity("Chunks"))).setBinding((options, value) -> {
        IrisVideoSettings.shadowDistance = value;
        try {
            Iris.getIrisConfig().save();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }, options -> IrisVideoSettings.getOverriddenShadowDistance(IrisVideoSettings.shadowDistance)).setImpact(OptionImpact.HIGH).setEnabled(true).build();
    ((OptionImplExtended) maxShadowDistanceSlider).iris$dynamicallyEnable(IrisVideoSettings::isShadowDistanceSliderEnabled);
    return maxShadowDistanceSlider;
}
Also used : Iris(net.coderbot.iris.Iris) OptionFlag(me.jellysquid.mods.sodium.client.gui.options.OptionFlag) Options(net.minecraft.client.Options) OptionImpl(me.jellysquid.mods.sodium.client.gui.options.OptionImpl) MinecraftOptionsStorage(me.jellysquid.mods.sodium.client.gui.options.storage.MinecraftOptionsStorage) CyclingControl(me.jellysquid.mods.sodium.client.gui.options.control.CyclingControl) IOException(java.io.IOException) ControlValueFormatter(me.jellysquid.mods.sodium.client.gui.options.control.ControlValueFormatter) IrisVideoSettings(net.coderbot.iris.gui.option.IrisVideoSettings) OptionImpact(me.jellysquid.mods.sodium.client.gui.options.OptionImpact) SliderControl(me.jellysquid.mods.sodium.client.gui.options.control.SliderControl) Options(net.minecraft.client.Options) IrisVideoSettings(net.coderbot.iris.gui.option.IrisVideoSettings) IOException(java.io.IOException) SliderControl(me.jellysquid.mods.sodium.client.gui.options.control.SliderControl)

Aggregations

IOException (java.io.IOException)1 OptionFlag (me.jellysquid.mods.sodium.client.gui.options.OptionFlag)1 OptionImpact (me.jellysquid.mods.sodium.client.gui.options.OptionImpact)1 OptionImpl (me.jellysquid.mods.sodium.client.gui.options.OptionImpl)1 ControlValueFormatter (me.jellysquid.mods.sodium.client.gui.options.control.ControlValueFormatter)1 CyclingControl (me.jellysquid.mods.sodium.client.gui.options.control.CyclingControl)1 SliderControl (me.jellysquid.mods.sodium.client.gui.options.control.SliderControl)1 MinecraftOptionsStorage (me.jellysquid.mods.sodium.client.gui.options.storage.MinecraftOptionsStorage)1 Iris (net.coderbot.iris.Iris)1 IrisVideoSettings (net.coderbot.iris.gui.option.IrisVideoSettings)1 Options (net.minecraft.client.Options)1