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