FML3 support
This commit is contained in:
parent
e754f58623
commit
b8c905e619
|
|
@ -5,7 +5,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = "org.adde0109"
|
||||
version = "1.4.0-beta"
|
||||
version = "1.4.0-beta-rc1"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19;
|
|||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19_3;
|
||||
import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdentifier.mapSet;
|
||||
|
||||
@Plugin(id = "ambassador", name = "Ambassador", version = "1.4.0-beta", authors = {"adde0109"})
|
||||
@Plugin(id = "ambassador", name = "Ambassador", version = "1.4.0-beta-rc1", authors = {"adde0109"})
|
||||
public class Ambassador {
|
||||
|
||||
public ProxyServer server;
|
||||
|
|
|
|||
|
|
@ -71,13 +71,23 @@ public class ForgeHandshakeUtils {
|
|||
return dataAndPacketIdStream.toByteArray();
|
||||
}
|
||||
|
||||
public static final byte[] emptyModlist = generateEmptyModlist();
|
||||
private static byte[] generateEmptyModlist() {
|
||||
public static final byte[] emptyModlistFML2 = generateEmptyModlist(2);
|
||||
public static final byte[] emptyModlistFML3 = generateEmptyModlist(3);
|
||||
private static byte[] generateEmptyModlist(int fmlVersion) {
|
||||
ByteArrayDataOutput dataAndPacketIdStream = ByteStreams.newDataOutput();
|
||||
writeVarInt(dataAndPacketIdStream,1);
|
||||
writeVarInt(dataAndPacketIdStream,0);
|
||||
writeVarInt(dataAndPacketIdStream,0);
|
||||
writeVarInt(dataAndPacketIdStream,0);
|
||||
writeVarInt(dataAndPacketIdStream,0); //Mods
|
||||
if (fmlVersion == 3) {
|
||||
writeVarInt(dataAndPacketIdStream,1); //Channels
|
||||
writeUtf(dataAndPacketIdStream, "forge:tier_sorting");
|
||||
writeUtf(dataAndPacketIdStream,"1.0");
|
||||
writeVarInt(dataAndPacketIdStream,0); //Registries
|
||||
writeVarInt(dataAndPacketIdStream,0); //Data-packs
|
||||
} else {
|
||||
writeVarInt(dataAndPacketIdStream,0); //Channels
|
||||
writeVarInt(dataAndPacketIdStream,0); //Registries
|
||||
}
|
||||
|
||||
|
||||
ByteArrayDataOutput stream = ByteStreams.newDataOutput();
|
||||
byte[] dataAndPacketId = dataAndPacketIdStream.toByteArray();
|
||||
|
|
|
|||
|
|
@ -152,7 +152,8 @@ public enum VelocityForgeClientConnectionPhase implements ClientConnectionPhase
|
|||
|
||||
public void sendVanillaModlist(ConnectedPlayer player) {
|
||||
player.getConnection().write(new LoginPluginMessage(0, "fml:loginwrapper",
|
||||
Unpooled.wrappedBuffer(ForgeHandshakeUtils.emptyModlist)));
|
||||
Unpooled.wrappedBuffer(player.getConnection().getType() == ForgeConstants.ForgeFML3 ?
|
||||
ForgeHandshakeUtils.emptyModlistFML3 : ForgeHandshakeUtils.emptyModlistFML2)));
|
||||
|
||||
ForgeLoginWrapperDecoder decoder = (ForgeLoginWrapperDecoder) player.getConnection()
|
||||
.getChannel().pipeline().get(ForgeConstants.FORGE_HANDSHAKE_DECODER);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user