mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2025-01-02 18:17:36 +01:00
Merge branch 'main' into pr/addr-parser
This commit is contained in:
commit
d5599414cc
19
build.gradle
19
build.gradle
@ -84,8 +84,23 @@ allprojects {
|
||||
}
|
||||
|
||||
subprojects {
|
||||
loom {
|
||||
runs {
|
||||
named("client") {
|
||||
client()
|
||||
ideConfigGenerated(true)
|
||||
runDir("run")
|
||||
}
|
||||
named("server") {
|
||||
server()
|
||||
ideConfigGenerated(true)
|
||||
runDir("run")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(rootProject) {
|
||||
implementation(project(path: ":", configuration: "namedElements")) {
|
||||
exclude group: "net.fabricmc", module: "fabric-loader" // prevent duplicate fabric-loader on run
|
||||
}
|
||||
}
|
||||
@ -126,7 +141,7 @@ static void setupRepositories(RepositoryHandler repositories) {
|
||||
}
|
||||
|
||||
subprojects.each {
|
||||
remapJar.dependsOn("${it.path}:remapJar")
|
||||
rootProject.remapJar.dependsOn("${it.path}:remapJar")
|
||||
}
|
||||
|
||||
configurations {
|
||||
|
@ -31,7 +31,7 @@ public class HostnameParserProtocol extends AbstractSimpleProtocol {
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
registerServerbound(State.HANDSHAKE, ServerboundHandshakePackets.CLIENT_INTENTION.getId(), ServerboundHandshakePackets.CLIENT_INTENTION.getId(), new PacketHandlers() {
|
||||
registerServerbound(State.HANDSHAKE, ServerboundHandshakePackets.CLIENT_INTENTION, new PacketHandlers() {
|
||||
@Override
|
||||
protected void register() {
|
||||
map(Types.VAR_INT); // Protocol version
|
||||
|
@ -31,9 +31,8 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.exception.CancelException;
|
||||
import com.viaversion.viaversion.protocol.version.BaseVersionProvider;
|
||||
import com.viaversion.viaversion.protocols.base.BaseProtocol1_16;
|
||||
import com.viaversion.viaversion.protocols.base.BaseProtocol1_7;
|
||||
import com.viaversion.viaversion.protocols.base.ClientboundStatusPackets;
|
||||
import com.viaversion.viaversion.protocols.base.v1_7.ClientboundBaseProtocol1_7;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
@ -150,7 +149,7 @@ public abstract class AbstractFabricVersionProvider extends BaseVersionProvider
|
||||
getLogger().info("Sending " + multiconnectSuggestion + " for multiconnect version detector");
|
||||
PacketWrapper newAnswer = PacketWrapper.create(ClientboundStatusPackets.STATUS_RESPONSE, null, connection);
|
||||
newAnswer.write(Types.STRING, "{\"version\":{\"name\":\"viafabric integration\",\"protocol\":" + multiconnectSuggestion.getVersion() + "}}");
|
||||
newAnswer.send(info.getPipeline().contains(BaseProtocol1_16.class) ? BaseProtocol1_16.class : BaseProtocol1_7.class);
|
||||
newAnswer.send(ClientboundBaseProtocol1_7.class);
|
||||
throw CancelException.generate();
|
||||
}
|
||||
}
|
||||
|
@ -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