mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-12-18 15:47:46 +01:00
Move out handshake accessor interface
This commit is contained in:
parent
fc1bd8a1cc
commit
56b3e56c9f
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
Allows the connection to/from different Minecraft versions on your Minecraft client/server (LAN worlds too)
|
Allows the connection to/from different Minecraft versions on your Minecraft client/server (LAN worlds too)
|
||||||
|
|
||||||
This mod can be installed on 1.8.9, 1.12.2, 1.14.4, 1.15.2, 1.16.5, 1.17.1, 1.18.2, 1.19.4, 1.20.4 with Fabric Loader.
|
This mod can be installed on 1.8.9, 1.12.2, 1.14.4, 1.15.2, 1.16.5, 1.17.1, 1.18.2, 1.19.4, 1.20.4, 1.20.5 with Fabric Loader.
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.viaversion.fabric.mc1122.mixin.pipeline.client;
|
package com.viaversion.fabric.mc1122.mixin.pipeline.client;
|
||||||
|
|
||||||
import com.viaversion.fabric.mc1122.service.ProtocolAutoDetector;
|
import com.viaversion.fabric.mc1122.service.HandshakeInterceptor;
|
||||||
import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
|
import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
@Mixin(HandshakeC2SPacket.class)
|
@Mixin(HandshakeC2SPacket.class)
|
||||||
public class MixinHandshakeC2SPacket implements ProtocolAutoDetector.IHandshakeC2SPacket {
|
public class MixinHandshakeC2SPacket implements HandshakeInterceptor {
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
private int protocolVersion;
|
private int protocolVersion;
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
package com.viaversion.fabric.mc1122.service;
|
||||||
|
|
||||||
|
public interface HandshakeInterceptor {
|
||||||
|
|
||||||
|
void viaFabric$setProtocolVersion(final int version);
|
||||||
|
}
|
@ -113,7 +113,7 @@ public class ProtocolAutoDetector {
|
|||||||
|
|
||||||
HandshakeC2SPacket handshakeC2SPacket = new HandshakeC2SPacket(address.getHostString(),
|
HandshakeC2SPacket handshakeC2SPacket = new HandshakeC2SPacket(address.getHostString(),
|
||||||
address.getPort(), NetworkState.STATUS);
|
address.getPort(), NetworkState.STATUS);
|
||||||
((IHandshakeC2SPacket) handshakeC2SPacket).viaFabric$setProtocolVersion(
|
((HandshakeInterceptor) handshakeC2SPacket).viaFabric$setProtocolVersion(
|
||||||
Via.getAPI().getServerVersion().lowestSupportedVersion());
|
Via.getAPI().getServerVersion().lowestSupportedVersion());
|
||||||
clientConnection.send(handshakeC2SPacket);
|
clientConnection.send(handshakeC2SPacket);
|
||||||
clientConnection.send(new QueryRequestC2SPacket());
|
clientConnection.send(new QueryRequestC2SPacket());
|
||||||
@ -138,9 +138,4 @@ public class ProtocolAutoDetector {
|
|||||||
return CompletableFuture.completedFuture(null);
|
return CompletableFuture.completedFuture(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IHandshakeC2SPacket {
|
|
||||||
|
|
||||||
void viaFabric$setProtocolVersion(final int version);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user