diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatInputSuggestor.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatInputSuggestor.java new file mode 100644 index 00000000..f0f41ea1 --- /dev/null +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/screen/MixinChatInputSuggestor.java @@ -0,0 +1,38 @@ +/* + * 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 . + */ +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.option.SimpleOption; +import net.raphimc.vialoader.util.VersionEnum; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(ChatInputSuggestor.class) +public class MixinChatInputSuggestor { + + @Redirect(method = "showCommandSuggestions", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/SimpleOption;getValue()Ljava/lang/Object;")) + public Object forceDisableAutoCompletions(SimpleOption instance) { + if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) { + return false; + } + return instance.getValue(); + } +} diff --git a/src/main/resources/viafabricplus.mixins.json b/src/main/resources/viafabricplus.mixins.json index b03271b4..0348e58c 100644 --- a/src/main/resources/viafabricplus.mixins.json +++ b/src/main/resources/viafabricplus.mixins.json @@ -28,6 +28,7 @@ "fixes.minecraft.MixinClientPlayerInteractionManager", "fixes.minecraft.MixinClientPlayNetworkHandler", "fixes.minecraft.MixinDrawContext", + "fixes.minecraft.MixinFontStorage", "fixes.minecraft.MixinHandledScreens", "fixes.minecraft.MixinInGameHud", "fixes.minecraft.MixinItemRenderer", @@ -86,7 +87,6 @@ "fixes.minecraft.entity.MixinSquidEntity", "fixes.minecraft.entity.MixinVexEntity", "fixes.minecraft.entity.MixinWolfEntity", - "fixes.minecraft.MixinFontStorage", "fixes.minecraft.input.MixinKeyboard", "fixes.minecraft.input.MixinKeyboardInput", "fixes.minecraft.input.MixinMouse", @@ -113,6 +113,7 @@ "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",