Added better default for tab completion delay in <= 1.12.2

This commit is contained in:
FlorianMichael 2023-08-12 15:16:19 +02:00
parent 18a6c449d1
commit 80c943cc89
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
3 changed files with 5 additions and 44 deletions

View File

@ -1,43 +0,0 @@
/*
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
import net.minecraft.client.gui.screen.ChatInputSuggestor;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.option.SimpleOption;
import net.raphimc.vialoader.util.VersionEnum;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ChatInputSuggestor.class)
public class MixinChatInputSuggestor {
@Shadow @Final private TextFieldWidget textField;
@Redirect(method = "showCommandSuggestions", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/SimpleOption;getValue()Ljava/lang/Object;"))
public Object forceDisableAutoCompletions(SimpleOption instance) {
if (this.textField.getText().startsWith("/") && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) {
return false;
}
return instance.getValue();
}
}

View File

@ -42,4 +42,9 @@ public class ViaFabricPlusVLViaConfig extends VLViaConfig {
public boolean isChunkBorderFix() {
return ExperimentalSettings.INSTANCE.fixChunkBorders.getValue();
}
@Override
public int get1_13TabCompleteDelay() {
return 5;
}
}

View File

@ -114,7 +114,6 @@
"fixes.minecraft.packet.MixinUpdatePlayerAbilitiesC2SPacket",
"fixes.minecraft.screen.MixinAnvilScreen",
"fixes.minecraft.screen.MixinChatHud",
"fixes.minecraft.screen.MixinChatInputSuggestor",
"fixes.minecraft.screen.MixinChatScreen",
"fixes.minecraft.screen.MixinCommandBlockScreen",
"fixes.minecraft.screen.MixinConnectScreen_1",