mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-11-21 11:35:16 +01:00
Move protocol detector outside of sync block (#370)
* Move protocol detector injection outside of sync block Fixes ViaVersion/ViaFabric#302 * Fix bad package reference for 1.20.1 * Revert 1.20.1's move * Omit static on mixins
This commit is contained in:
parent
c5dcc31c37
commit
5e59b9d947
@ -17,23 +17,22 @@
|
||||
*/
|
||||
package com.viaversion.fabric.mc1204.mixin.pipeline.client;
|
||||
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.fabric.mc1204.ViaFabric;
|
||||
import com.viaversion.fabric.mc1204.service.ProtocolAutoDetector;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
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.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@Mixin(ClientConnection.class)
|
||||
public class MixinClientConnection {
|
||||
@Inject(method = "connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/network/ClientConnection;)Lio/netty/channel/ChannelFuture;", at = @At("HEAD"))
|
||||
private static void onConnect(InetSocketAddress address, boolean useEpoll, ClientConnection connection, CallbackInfoReturnable<ChannelFuture> cir) {
|
||||
@Mixin(targets = "net/minecraft/client/gui/screen/multiplayer/ConnectScreen$1")
|
||||
public class MixinClientConnectionThread {
|
||||
@Inject(method = "run", at = @At(value = "INVOKE_ASSIGN", args = "fuzz=2", target = "Ljava/util/Optional;get()Ljava/lang/Object;"))
|
||||
private void onConnect(CallbackInfo ci, @Local InetSocketAddress address) {
|
||||
try {
|
||||
if (!ViaFabric.config.isClientSideEnabled()) return;
|
||||
ProtocolAutoDetector.detectVersion(address).get(10, TimeUnit.SECONDS);
|
@ -6,7 +6,7 @@
|
||||
"MixinClientConnection"
|
||||
],
|
||||
"client": [
|
||||
"client.MixinClientConnection"
|
||||
"client.MixinClientConnectionThread"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
@ -17,23 +17,22 @@
|
||||
*/
|
||||
package com.viaversion.fabric.mc1206.mixin.pipeline.client;
|
||||
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.fabric.mc1206.ViaFabric;
|
||||
import com.viaversion.fabric.mc1206.service.ProtocolAutoDetector;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
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.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@Mixin(ClientConnection.class)
|
||||
public class MixinClientConnection {
|
||||
@Inject(method = "connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/network/ClientConnection;)Lio/netty/channel/ChannelFuture;", at = @At("HEAD"))
|
||||
private static void onConnect(InetSocketAddress address, boolean useEpoll, ClientConnection connection, CallbackInfoReturnable<ChannelFuture> cir) {
|
||||
@Mixin(targets = "net/minecraft/client/gui/screen/multiplayer/ConnectScreen$1")
|
||||
public class MixinClientConnectionThread {
|
||||
@Inject(method = "run", at = @At(value = "INVOKE_ASSIGN", args = "fuzz=2", target = "Ljava/util/Optional;get()Ljava/lang/Object;"))
|
||||
private void onConnect(CallbackInfo ci, @Local InetSocketAddress address) {
|
||||
try {
|
||||
if (!ViaFabric.config.isClientSideEnabled()) return;
|
||||
ProtocolAutoDetector.detectVersion(address).get(10, TimeUnit.SECONDS);
|
@ -6,7 +6,7 @@
|
||||
"MixinClientConnection"
|
||||
],
|
||||
"client": [
|
||||
"client.MixinClientConnection"
|
||||
"client.MixinClientConnectionThread"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
@ -17,23 +17,22 @@
|
||||
*/
|
||||
package com.viaversion.fabric.mc1211.mixin.pipeline.client;
|
||||
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.fabric.mc1211.ViaFabric;
|
||||
import com.viaversion.fabric.mc1211.service.ProtocolAutoDetector;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
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.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@Mixin(ClientConnection.class)
|
||||
public class MixinClientConnection {
|
||||
@Inject(method = "connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/network/ClientConnection;)Lio/netty/channel/ChannelFuture;", at = @At("HEAD"))
|
||||
private static void onConnect(InetSocketAddress address, boolean useEpoll, ClientConnection connection, CallbackInfoReturnable<ChannelFuture> cir) {
|
||||
@Mixin(targets = "net/minecraft/client/gui/screen/multiplayer/ConnectScreen$1")
|
||||
public class MixinClientConnectionThread {
|
||||
@Inject(method = "run", at = @At(value = "INVOKE_ASSIGN", args = "fuzz=2", target = "Ljava/util/Optional;get()Ljava/lang/Object;"))
|
||||
private void onConnect(CallbackInfo ci, @Local InetSocketAddress address) {
|
||||
try {
|
||||
if (!ViaFabric.config.isClientSideEnabled()) return;
|
||||
ProtocolAutoDetector.detectVersion(address).get(10, TimeUnit.SECONDS);
|
@ -6,7 +6,7 @@
|
||||
"MixinClientConnection"
|
||||
],
|
||||
"client": [
|
||||
"client.MixinClientConnection"
|
||||
"client.MixinClientConnectionThread"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
Loading…
Reference in New Issue
Block a user