Search in sources :

Example 1 with Options

use of net.minecraft.client.Options in project Artemis by Wynntils.

the class KeyManager method registerKeybind.

public static void registerKeybind(KeyHolder toAdd) {
    if (hasName(toAdd.getName())) {
        throw new IllegalStateException("Can not add " + toAdd + " since the name already exists");
    }
    keyHolders.add(toAdd);
    Options options = Minecraft.getInstance().options;
    if (options == null) {
        // loaded later by a mixin
        return;
    }
    synchronized (options) {
        KeyMapping[] keyMappings = options.keyMappings;
        List<KeyMapping> newKeyMappings = Lists.newArrayList(keyMappings);
        newKeyMappings.add(toAdd.getKeybind());
        ((OptionsAccessor) options).setKeyBindMixins(newKeyMappings.toArray(new KeyMapping[0]));
    }
}
Also used : Options(net.minecraft.client.Options) KeyMapping(net.minecraft.client.KeyMapping) OptionsAccessor(com.wynntils.mc.mixin.accessors.OptionsAccessor)

Example 2 with Options

use of net.minecraft.client.Options in project Artemis by Wynntils.

the class KeyManager method unregisterKeybind.

public static void unregisterKeybind(KeyHolder toAdd) {
    if (keyHolders.remove(toAdd)) {
        Options options = Minecraft.getInstance().options;
        synchronized (options) {
            KeyMapping[] keyMappings = options.keyMappings;
            List<KeyMapping> newKeyMappings = Lists.newArrayList(keyMappings);
            newKeyMappings.remove(toAdd.getKeybind());
            ((OptionsAccessor) options).setKeyBindMixins(newKeyMappings.toArray(new KeyMapping[0]));
        }
    }
}
Also used : Options(net.minecraft.client.Options) KeyMapping(net.minecraft.client.KeyMapping) OptionsAccessor(com.wynntils.mc.mixin.accessors.OptionsAccessor)

Example 3 with Options

use of net.minecraft.client.Options 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)

Example 4 with Options

use of net.minecraft.client.Options in project Create by Creators-of-Create.

the class LinkedControllerClientHandler method getControls.

public static Vector<KeyMapping> getControls() {
    if (controls == null) {
        Options gameSettings = Minecraft.getInstance().options;
        controls = new Vector<>(6);
        controls.add(gameSettings.keyUp);
        controls.add(gameSettings.keyDown);
        controls.add(gameSettings.keyLeft);
        controls.add(gameSettings.keyRight);
        controls.add(gameSettings.keyJump);
        controls.add(gameSettings.keyShift);
    }
    return controls;
}
Also used : Options(net.minecraft.client.Options)

Aggregations

Options (net.minecraft.client.Options)4 OptionsAccessor (com.wynntils.mc.mixin.accessors.OptionsAccessor)2 KeyMapping (net.minecraft.client.KeyMapping)2 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