Search in sources :

Example 6 with GameSettings

use of net.minecraft.client.GameSettings in project ModernUI by BloCamLimb.

the class SettingGeneral method addAccessibilityCategory.

private void addAccessibilityCategory(List<SettingCategoryGroup> groups) {
    List<SettingEntry> list = new ArrayList<>();
    GameSettings gameSettings = minecraft.gameSettings;
    list.add(SettingsManager.NARRATOR.apply(window));
    list.add(SettingsManager.SHOW_SUBTITLES.apply(window));
    List<String> textBackgrounds = Lists.newArrayList(I18n.format("options.accessibility.text_background.chat"), I18n.format("options.accessibility.text_background.everywhere"));
    list.add(new DropdownSettingEntry(window, I18n.format("options.accessibility.text_background"), textBackgrounds, gameSettings.accessibilityTextBackground ? 0 : 1, i -> gameSettings.accessibilityTextBackground = i == 0));
    list.add(SettingsManager.TEXT_BACKGROUND_OPACITY.apply(window));
    list.add(SettingsManager.AUTO_JUMP.apply(window));
    List<String> toggle = Lists.newArrayList(I18n.format("options.key.toggle"), I18n.format("options.key.hold"));
    DropdownSettingEntry sneak = new DropdownSettingEntry(window, I18n.format("key.sneak"), toggle, gameSettings.toggleCrouch ? 0 : 1, i -> gameSettings.toggleCrouch = i == 0);
    list.add(sneak);
    DropdownSettingEntry sprint = new DropdownSettingEntry(window, I18n.format("key.sprint"), toggle, gameSettings.toggleSprint ? 0 : 1, i -> gameSettings.toggleSprint = i == 0);
    list.add(sprint);
    SettingCategoryGroup categoryGroup = new SettingCategoryGroup(window, I18n.format("gui.modernui.settings.category.accessibility"), list);
    groups.add(categoryGroup);
}
Also used : ConfirmCallback(icyllis.modernui.test.popup.ConfirmCallback) ModernUI(icyllis.modernui.system.ModernUI) PopupConfirm(icyllis.modernui.test.popup.PopupConfirm) SettingScrollWindow(icyllis.modernui.impl.setting.SettingScrollWindow) CLockDifficultyPacket(net.minecraft.network.play.client.CLockDifficultyPacket) Collectors(java.util.stream.Collectors) UIManager(icyllis.modernui.view.UIManager) ArrayList(java.util.ArrayList) I18n(net.minecraft.client.resources.I18n) Objects(java.util.Objects) List(java.util.List) Lists(com.google.common.collect.Lists) CSetDifficultyPacket(net.minecraft.network.play.client.CSetDifficultyPacket) IModule(icyllis.modernui.test.discard.IModule) SettingsManager(icyllis.modernui.system.SettingsManager) GameSettings(net.minecraft.client.GameSettings) Module(icyllis.modernui.test.discard.Module) PlayerModelPart(net.minecraft.entity.player.PlayerModelPart) icyllis.modernui.impl.setting(icyllis.modernui.impl.setting) Difficulty(net.minecraft.world.Difficulty) ArrayList(java.util.ArrayList) GameSettings(net.minecraft.client.GameSettings)

Example 7 with GameSettings

use of net.minecraft.client.GameSettings in project BetterDiving by Meldexun.

the class EntitySeamoth method updateControls.

@OnlyIn(Dist.CLIENT)
public void updateControls() {
    Minecraft mc = Minecraft.getInstance();
    this.prevControlled = this.controlled;
    this.controlled = this.getControllingPassenger() == mc.player;
    this.prevSteered = this.isPlayerSteering();
    if (this.controlled) {
        GameSettings settings = mc.options;
        this.inputForward = settings.keyUp.isDown();
        this.inputRight = settings.keyRight.isDown();
        this.inputBack = settings.keyDown.isDown();
        this.inputLeft = settings.keyLeft.isDown();
        this.inputUp = settings.keyJump.isDown();
        this.inputDown = ClientBetterDiving.KEY_BIND_DESCEND.isDown();
        BetterDiving.NETWORK.sendToServer(new CPacketSyncSeamothInput(this));
    } else if (this.prevControlled) {
        this.inputForward = false;
        this.inputRight = false;
        this.inputBack = false;
        this.inputLeft = false;
        this.inputUp = false;
        this.inputDown = false;
        BetterDiving.NETWORK.sendToServer(new CPacketSyncSeamothInput(this));
    }
}
Also used : GameSettings(net.minecraft.client.GameSettings) Minecraft(net.minecraft.client.Minecraft) CPacketSyncSeamothInput(meldexun.better_diving.network.packet.client.CPacketSyncSeamothInput) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 8 with GameSettings

use of net.minecraft.client.GameSettings in project ModernUI by BloCamLimb.

the class KeyBindingEntry method bindKey.

private void bindKey(@Nonnull InputMappings.Input inputIn) {
    GameSettings gameSettings = Minecraft.getInstance().gameSettings;
    if (inputIn.getType() != InputMappings.Type.MOUSE) {
        keyBinding.setKeyModifierAndCode(KeyModifier.getActiveModifier(), inputIn);
    }
    gameSettings.setKeyBindingCode(keyBinding, inputIn);
    updateKeyText();
    conflictsCallback.run();
}
Also used : GameSettings(net.minecraft.client.GameSettings)

Aggregations

GameSettings (net.minecraft.client.GameSettings)8 ArrayList (java.util.ArrayList)3 List (java.util.List)2 Minecraft (net.minecraft.client.Minecraft)2 PlayerModelPart (net.minecraft.entity.player.PlayerModelPart)2 Lists (com.google.common.collect.Lists)1 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)1 Pair (com.mojang.datafixers.util.Pair)1 icyllis.modernui.impl.setting (icyllis.modernui.impl.setting)1 ResourcePackEntry (icyllis.modernui.impl.setting.ResourcePackEntry)1 SettingScrollWindow (icyllis.modernui.impl.setting.SettingScrollWindow)1 ModernUI (icyllis.modernui.system.ModernUI)1 SettingsManager (icyllis.modernui.system.SettingsManager)1 IModule (icyllis.modernui.test.discard.IModule)1 Module (icyllis.modernui.test.discard.Module)1 ConfirmCallback (icyllis.modernui.test.popup.ConfirmCallback)1 PopupConfirm (icyllis.modernui.test.popup.PopupConfirm)1 UIManager (icyllis.modernui.view.UIManager)1 ICombatCapability (jackiecrazy.wardance.capability.resources.ICombatCapability)1 ISkillCapability (jackiecrazy.wardance.capability.skill.ISkillCapability)1