diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-07-05 23:39:09 +0900 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-07-05 23:39:09 +0900 |
commit | 54d915940ee0856bc7cac4a37687cb7783e07cee (patch) | |
tree | f5952503eb3bc095914f4f77b81531ab2c050d90 /versions/1.12.2-forge | |
parent | 6cafd268d486a930c7e8bec229c30eb6a50fe436 (diff) | |
parent | 206063acf3a6e0edc0d16b07d206aa36207b42d4 (diff) | |
download | OneConfig-54d915940ee0856bc7cac4a37687cb7783e07cee.tar.gz OneConfig-54d915940ee0856bc7cac4a37687cb7783e07cee.tar.bz2 OneConfig-54d915940ee0856bc7cac4a37687cb7783e07cee.zip |
Merge branch 'self' of https://github.com/nxtdaydelivery/OneConfig into nextdaydelivery-self
Diffstat (limited to 'versions/1.12.2-forge')
5 files changed, 19 insertions, 54 deletions
diff --git a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java index 5b54e8e..d2a68ff 100644 --- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java +++ b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java @@ -2,9 +2,7 @@ package cc.polyfrost.oneconfig.internal.mixin; import cc.polyfrost.oneconfig.events.EventManager; import cc.polyfrost.oneconfig.events.event.ChatReceiveEvent; -import cc.polyfrost.oneconfig.events.event.SendPacketEvent; import net.minecraft.client.network.NetHandlerPlayClient; -import net.minecraft.network.Packet; import net.minecraft.network.play.server.SPacketChat; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -14,15 +12,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(value = NetHandlerPlayClient.class, priority = Integer.MAX_VALUE) public class NetHandlerPlayClientMixin { - @Inject(method = "sendPacket", 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(Lnet/minecraft/util/text/ChatType;Lnet/minecraft/util/text/ITextComponent;)Lnet/minecraft/util/text/ITextComponent;", remap = false), cancellable = true, remap = true) private void onClientChat(SPacketChat packetIn, CallbackInfo ci) { if (packetIn.getType().getId() == 0) { diff --git a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java index 7ddaf80..023fdaa 100644 --- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java +++ b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java @@ -2,7 +2,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; @@ -12,6 +15,22 @@ 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/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java deleted file mode 100644 index eb6fc03..0000000 --- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java +++ /dev/null @@ -1,21 +0,0 @@ -package cc.polyfrost.oneconfig.internal.mixin; - -import cc.polyfrost.oneconfig.internal.plugin.hooks.OptifineConfigHook; -import org.spongepowered.asm.mixin.Dynamic; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Pseudo; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Pseudo -@Mixin(targets = "Config", remap = false) -public class OptifineConfigMixin { - @Dynamic("OptiFine") - @Inject(method = "isFastRender", at = @At("HEAD"), cancellable = true) - private static void cancelFastRender(CallbackInfoReturnable<Boolean> cir) { - if (OptifineConfigHook.shouldNotApplyFastRender()) { - cir.setReturnValue(false); - } - } -}
\ No newline at end of file diff --git a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java deleted file mode 100644 index 2ec0024..0000000 --- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ShaderGroupAccessor.java +++ /dev/null @@ -1,14 +0,0 @@ -package cc.polyfrost.oneconfig.internal.mixin; - -import net.minecraft.client.shader.Shader; -import net.minecraft.client.shader.ShaderGroup; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import java.util.List; - -@Mixin(ShaderGroup.class) -public interface ShaderGroupAccessor { - @Accessor("listShaders") - List<Shader> getListShaders(); -}
\ No newline at end of file diff --git a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java deleted file mode 100644 index 04e3fe9..0000000 --- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/VigilantMixin.java +++ /dev/null @@ -1,8 +0,0 @@ -package cc.polyfrost.oneconfig.internal.mixin; - -import gg.essential.vigilance.Vigilant; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin(Vigilant.class) -public class VigilantMixin { -}
\ No newline at end of file |