zeta compatibility fixed
This commit is contained in:
parent
b91d767163
commit
45e41a5b83
|
|
@ -1,5 +1,7 @@
|
|||
package org.adde0109.ambassador.forge;
|
||||
|
||||
import org.adde0109.ambassador.forge.packet.Context;
|
||||
import org.adde0109.ambassador.forge.packet.GenericForgeLoginWrapperPacket;
|
||||
import org.adde0109.ambassador.forge.packet.ModListReplyPacket;
|
||||
import org.adde0109.ambassador.forge.packet.RegistryPacket;
|
||||
|
||||
|
|
@ -11,6 +13,7 @@ import java.util.zip.Checksum;
|
|||
public class ForgeHandshake {
|
||||
private ModListReplyPacket modListReplyPacket;
|
||||
private final Map<String, Long> registries = new HashMap<>();
|
||||
public GenericForgeLoginWrapperPacket<Context.ClientContext> zetaFlagsPacket;
|
||||
|
||||
public ForgeHandshake() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,17 +122,17 @@ public class ForgeHandshakeUtils {
|
|||
static enum ThirdPartyChannel {
|
||||
SILENTGEAR_NETWORK {
|
||||
@Override
|
||||
public ThirdPartyRegistryUtils.ACKPacket generateResponsePacket(Context.ClientContext context) {
|
||||
public IForgeLoginWrapperPacket<Context.ClientContext> generateResponsePacket(Context.ClientContext context, ForgeHandshake completed) {
|
||||
return new ACKPacket(context, 3);
|
||||
}
|
||||
},
|
||||
ZETA_MAIN {
|
||||
@Override
|
||||
public ThirdPartyRegistryUtils.ACKPacket generateResponsePacket(Context.ClientContext context) {
|
||||
return new ACKPacket(context, 99);
|
||||
public IForgeLoginWrapperPacket<Context.ClientContext> generateResponsePacket(Context.ClientContext context, ForgeHandshake completed) {
|
||||
return new GenericForgeLoginWrapperPacket<Context.ClientContext>(completed.zetaFlagsPacket.getContent(), context);
|
||||
}
|
||||
};
|
||||
abstract public ACKPacket generateResponsePacket(Context.ClientContext context);
|
||||
abstract public IForgeLoginWrapperPacket<Context.ClientContext> generateResponsePacket(Context.ClientContext context, ForgeHandshake completed);
|
||||
}
|
||||
|
||||
static boolean isThirdPartyPacket(GenericForgeLoginWrapperPacket<Context> packet) {
|
||||
|
|
|
|||
|
|
@ -139,7 +139,11 @@ public enum VelocityForgeBackendConnectionPhase implements BackendConnectionPhas
|
|||
server.getConnection().write(new ACKPacket(Context.fromContext(message.getContext(), true)));
|
||||
} else if (message instanceof GenericForgeLoginWrapperPacket<Context> packet
|
||||
&& ForgeHandshakeUtils.ThirdPartyRegistryUtils.isThirdPartyPacket(packet)) {
|
||||
server.getConnection().write(ForgeHandshakeUtils.ThirdPartyRegistryUtils.getThirdPartyChannel(packet));
|
||||
server.getConnection().write(
|
||||
ForgeHandshakeUtils.ThirdPartyRegistryUtils.getThirdPartyChannel(packet).
|
||||
generateResponsePacket(
|
||||
Context.ClientContext.fromContext(packet.getContext(), true),
|
||||
clientPhase.forgeHandshake));
|
||||
}
|
||||
}
|
||||
//Forge server
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import io.netty.buffer.Unpooled;
|
|||
import net.kyori.adventure.text.Component;
|
||||
import org.adde0109.ambassador.Ambassador;
|
||||
import org.adde0109.ambassador.forge.packet.Context;
|
||||
import org.adde0109.ambassador.forge.packet.GenericForgeLoginWrapperPacket;
|
||||
import org.adde0109.ambassador.forge.packet.IForgeLoginWrapperPacket;
|
||||
import org.adde0109.ambassador.forge.packet.ModListReplyPacket;
|
||||
import org.adde0109.ambassador.velocity.client.FML2CRPMResetCompleteDecoder;
|
||||
|
|
@ -129,6 +130,10 @@ public enum VelocityForgeClientConnectionPhase implements ClientConnectionPhase
|
|||
|
||||
public boolean handle(ConnectedPlayer player, IForgeLoginWrapperPacket<Context.ClientContext> msg, VelocityServerConnection server) {
|
||||
|
||||
if (msg.getContext().getChannelName().equals("zeta:main")) {
|
||||
forgeHandshake.zetaFlagsPacket = (GenericForgeLoginWrapperPacket<Context.ClientContext>) msg;
|
||||
}
|
||||
|
||||
if (msg instanceof ModListReplyPacket replyPacket) {
|
||||
ModInfo modInfo = new ModInfo("FML2", replyPacket.getMods().stream().map(
|
||||
(v) -> new ModInfo.Mod(v,"1")).toList());
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public class GenericForgeLoginWrapperPacket<T extends Context> implements IForge
|
|||
private final byte[] content;
|
||||
private final T context;
|
||||
|
||||
GenericForgeLoginWrapperPacket(byte[] content, T context) {
|
||||
public GenericForgeLoginWrapperPacket(byte[] content, T context) {
|
||||
this.content = content;
|
||||
this.context = context;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user