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]));
}
}
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]));
}
}
}
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;
}
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;
}
Aggregations