diff options
Diffstat (limited to 'versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin')
6 files changed, 22 insertions, 19 deletions
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java index 0603d12..23d7d84 100644 --- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java +++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java @@ -1,9 +1,9 @@ //#if MC==10809 package cc.polyfrost.oneconfig.internal.mixin; -import cc.polyfrost.oneconfig.internal.OneConfig; import cc.polyfrost.oneconfig.events.EventManager; import cc.polyfrost.oneconfig.events.event.*; +import cc.polyfrost.oneconfig.internal.OneConfig; import net.minecraft.client.Minecraft; import net.minecraft.util.Timer; import net.minecraftforge.client.event.GuiOpenEvent; diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java index 7a446c7..5ae6730 100644 --- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java +++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java @@ -15,15 +15,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(value = NetHandlerPlayClient.class, priority = Integer.MAX_VALUE) public class NetHandlerPlayClientMixin { - @Inject(method = "addToSendQueue", at = @At("HEAD"), cancellable = true) - private void onSendPacket(Packet<?> p_147297_1_, CallbackInfo ci) { - SendPacketEvent event = new SendPacketEvent(p_147297_1_); - EventManager.INSTANCE.post(event); - if (event.isCancelled) { - ci.cancel(); - } - } - @Inject(method = "handleChat", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/event/ForgeEventFactory;onClientChat(BLnet/minecraft/util/IChatComponent;)Lnet/minecraft/util/IChatComponent;", remap = false), cancellable = true, remap = true) private void onClientChat(S02PacketChat packetIn, CallbackInfo ci) { if (packetIn.getType() == 0) { diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java index 3da0c91..5b99446 100644 --- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java +++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java @@ -3,7 +3,10 @@ package cc.polyfrost.oneconfig.internal.mixin; import cc.polyfrost.oneconfig.events.EventManager; import cc.polyfrost.oneconfig.events.event.ReceivePacketEvent; +import cc.polyfrost.oneconfig.events.event.SendPacketEvent; import io.netty.channel.ChannelHandlerContext; +import io.netty.util.concurrent.Future; +import io.netty.util.concurrent.GenericFutureListener; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import org.spongepowered.asm.mixin.Mixin; @@ -13,6 +16,21 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(value = NetworkManager.class, priority = Integer.MAX_VALUE) public class NetworkManagerMixin { + + @Inject(method = "sendPacket(Lnet/minecraft/network/Packet;Lio/netty/util/concurrent/GenericFutureListener;[Lio/netty/util/concurrent/GenericFutureListener;)V", at = @At("HEAD"), cancellable = true) + private void onSendPacket(Packet<?> packetIn, GenericFutureListener<? extends Future<? super Void>> listener, GenericFutureListener<? extends Future<? super Void>>[] listeners, CallbackInfo ci) { + onSendPacket(packetIn, ci); + } + + @Inject(method = "sendPacket(Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true) + private void onSendPacket(Packet<?> packetIn, CallbackInfo ci) { + SendPacketEvent event = new SendPacketEvent(packetIn); + EventManager.INSTANCE.post(event); + if (event.isCancelled) { + ci.cancel(); + } + } + @Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true) private void onReceivePacket(ChannelHandlerContext p_channelRead0_1_, Packet<?> p_channelRead0_2_, CallbackInfo ci) { ReceivePacketEvent event = new ReceivePacketEvent(p_channelRead0_2_); diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java index 9012091..eb6fc03 100644 --- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java +++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java @@ -1,4 +1,3 @@ -//#if MC==10809 package cc.polyfrost.oneconfig.internal.mixin; import cc.polyfrost.oneconfig.internal.plugin.hooks.OptifineConfigHook; @@ -19,5 +18,4 @@ public class OptifineConfigMixin { cir.setReturnValue(false); } } -} -//#endif
\ No newline at end of file +}
\ No newline at end of file diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java index 588da19..2ec0024 100644 --- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java +++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java @@ -1,4 +1,3 @@ -//#if MC==10809 package cc.polyfrost.oneconfig.internal.mixin; import net.minecraft.client.shader.Shader; @@ -12,5 +11,4 @@ import java.util.List; public interface ShaderGroupAccessor { @Accessor("listShaders") List<Shader> getListShaders(); -} -//#endif
\ No newline at end of file +}
\ No newline at end of file diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java index 6b474ab..04e3fe9 100644 --- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java +++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java @@ -1,4 +1,3 @@ -//#if MC==10809 package cc.polyfrost.oneconfig.internal.mixin; import gg.essential.vigilance.Vigilant; @@ -6,5 +5,4 @@ import org.spongepowered.asm.mixin.Mixin; @Mixin(Vigilant.class) public class VigilantMixin { -} -//#endif
\ No newline at end of file +}
\ No newline at end of file |