mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-25 22:11:32 +01:00
Fixed RUN_COMMAND action not working for normal chat messages (<= 1.19)
This commit is contained in:
parent
b69b54d2c6
commit
72470984b8
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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.SharedConstants;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.text.Style;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
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.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(Screen.class)
|
||||
public class MixinScreen {
|
||||
|
||||
@Shadow @Nullable protected MinecraftClient client;
|
||||
|
||||
@Inject(method = "handleTextClick", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;)V", shift = At.Shift.BEFORE, ordinal = 1), cancellable = true)
|
||||
public void allowRunCommandAction(Style style, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19)) {
|
||||
this.client.player.networkHandler.sendChatMessage(SharedConstants.stripInvalidChars(style.getClickEvent().getValue()));
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -123,6 +123,7 @@
|
||||
"fixes.minecraft.screen.MixinGameModeSelectionScreen",
|
||||
"fixes.minecraft.screen.MixinGameModeSelectionScreen_GameModeSelection",
|
||||
"fixes.minecraft.screen.MixinJigsawBlockScreen",
|
||||
"fixes.minecraft.screen.MixinScreen",
|
||||
"fixes.minecraft.screen.MixinStructureBlockScreen_1",
|
||||
"fixes.minecraft.screen.merchant.MixinMerchantScreen",
|
||||
"fixes.minecraft.screen.merchant.MixinMerchantScreenHandler",
|
||||
@ -148,6 +149,7 @@
|
||||
"fixes.viaversion.protocol1_13to1_12_2.MixinGlassConnectionHandler",
|
||||
"fixes.viaversion.protocol1_13to1_12_2.MixinSkullHandler",
|
||||
"fixes.viaversion.protocol1_13to1_12_2.MixinWorldPackets1_13",
|
||||
"fixes.viaversion.protocol1_14to1_13_2.MixinInventoryPackets",
|
||||
"fixes.viaversion.protocol1_14to1_13_2.MixinInventoryPackets_2",
|
||||
"fixes.viaversion.protocol1_15to1_14_4.MixinMetadataRewriter1_15To1_14_4",
|
||||
"fixes.viaversion.protocol1_16_2to1_16_1.MixinWorldPackets_2",
|
||||
@ -167,8 +169,7 @@
|
||||
"fixes.viaversion.protocol1_9to1_8.MixinViaIdleThread",
|
||||
"jsonwebtoken.MixinClasses",
|
||||
"jsonwebtoken.MixinDefaultCompressionCodecResolver",
|
||||
"jsonwebtoken.MixinDefaultJwtParserBuilder",
|
||||
"fixes.viaversion.protocol1_14to1_13_2.MixinInventoryPackets"
|
||||
"jsonwebtoken.MixinDefaultJwtParserBuilder"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
Loading…
Reference in New Issue
Block a user