Properly save and replay FMLProxyPackets

During recording FMLProxyPackets are converted to S3FPacketCustomPayload
During playback the normal Forge network stack is used to handle these packets
This commit is contained in:
CrushedPixel
2016-09-04 14:25:33 +02:00
committed by johni0702
parent 2a73faed6c
commit 79bc6a8a7b
3 changed files with 14 additions and 5 deletions

View File

@@ -68,8 +68,11 @@ public class ConnectionEventHandler {
String worldName;
if(event.isLocal) {
worldName = MinecraftServer.getServer().getWorldName();
} else {
} else if (Minecraft.getMinecraft().getCurrentServerData() != null) {
worldName = Minecraft.getMinecraft().getCurrentServerData().serverIP;
} else {
logger.info("Recording not started as the world is neither local nor remote (probably a replay).");
return;
}
Channel channel = nm.channel();
ChannelPipeline pipeline = channel.pipeline();

View File

@@ -165,6 +165,7 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
if (packet instanceof FMLProxyPacket) {
// This packet requires special handling
((FMLProxyPacket) packet).toS3FPackets().forEach(this::save);
super.channelRead(ctx, msg);
return;
}