From 139089d9beb134465737c4afff3b1303bf481aa1 Mon Sep 17 00:00:00 2001 From: nea Date: Mon, 25 Sep 2023 19:24:16 +0200 Subject: Port to 1.20.2 --- .../firmament/mixins/devenv/DisableCommonPacketWarnings.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main/java/moe/nea/firmament/mixins/devenv') diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java b/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java index 9fc2ab0..3d557fc 100644 --- a/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java +++ b/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java @@ -7,21 +7,24 @@ package moe.nea.firmament.mixins.devenv; import net.minecraft.client.network.ClientPlayNetworkHandler; +import net.minecraft.network.packet.CustomPayload; import net.minecraft.util.Identifier; import org.slf4j.Logger; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.Objects; @Mixin(ClientPlayNetworkHandler.class) public class DisableCommonPacketWarnings { - @Redirect(method = "onCustomPayload", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false)) - public void onCustomPacket(Logger instance, String s, Object o) { - if (!Objects.equals(o, Identifier.of("badlion", "mods"))) { - instance.warn(s, o); + @Inject(method = "method_52801", at = @At("HEAD")) + public void onCustomPacketError(CustomPayload customPayload, CallbackInfo ci) { + if (Objects.equals(customPayload.id(), Identifier.of("badlion", "mods"))) { + ci.cancel(); } } -- cgit