From 78e3592bc1265a1e68336c503aa68971a956a6a6 Mon Sep 17 00:00:00 2001 From: Merrg1n <22628584+Merrg1n@users.noreply.github.com> Date: Sun, 14 Aug 2022 01:15:10 +0800 Subject: rewrite mixin --- .../EntityTrackerEntryMixin.java | 34 ++++++++-------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'src/main/java/com/keuin/ohmyvanillamc/mixins') diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixins/fix/disableEntityTrackerEntrySpamming/EntityTrackerEntryMixin.java b/src/main/java/com/keuin/ohmyvanillamc/mixins/fix/disableEntityTrackerEntrySpamming/EntityTrackerEntryMixin.java index 5b885a0..95fa8d3 100644 --- a/src/main/java/com/keuin/ohmyvanillamc/mixins/fix/disableEntityTrackerEntrySpamming/EntityTrackerEntryMixin.java +++ b/src/main/java/com/keuin/ohmyvanillamc/mixins/fix/disableEntityTrackerEntrySpamming/EntityTrackerEntryMixin.java @@ -1,32 +1,22 @@ package com.keuin.ohmyvanillamc.mixins.fix.disableEntityTrackerEntrySpamming; -import com.keuin.ohmyvanillamc.DummyLogger; import net.minecraft.server.network.EntityTrackerEntry; import org.apache.logging.log4j.Logger; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(EntityTrackerEntry.class) public class EntityTrackerEntryMixin { - - static { - setLOGGER(new DummyLogger()); - } - - @Shadow - @Final - private static Logger LOGGER; - - @Accessor("LOGGER") - private static Logger getLOGGER() { - throw new AssertionError(); + @Redirect( + method = "sendPackets", + at = @At( + value = "INVOKE", + target = "Lorg/apache/logging/log4j/Logger;warn(Ljava/lang/String;)V", + remap = false + ) + ) + private void disableWarn(Logger logger, String text) { + // do nothing } - - @Accessor("LOGGER") - private static void setLOGGER(Logger logger) { - throw new AssertionError(); - } - } -- cgit v1.2.3