Clean up parts of the recording module and add support for replay recovery after a crash

This commit is contained in:
johni0702
2016-07-29 14:55:22 +02:00
parent eedaf75e9e
commit 68c5d8583a
12 changed files with 484 additions and 424 deletions

View File

@@ -1,9 +1,8 @@
package eu.crushedpixel.replaymod.utils;
import com.google.gson.Gson;
import com.replaymod.recording.packet.PacketSerializer;
import com.replaymod.replaystudio.replay.ReplayMetaData;
import com.replaymod.core.ReplayMod;
import com.replaymod.replaystudio.replay.ReplayMetaData;
import eu.crushedpixel.replaymod.assets.CustomObjectRepository;
import eu.crushedpixel.replaymod.holders.PacketData;
import io.netty.buffer.ByteBuf;
@@ -27,7 +26,6 @@ import java.util.zip.ZipOutputStream;
@SuppressWarnings("resource") //Gets handled by finalizer
public class ReplayFileIO {
private static final PacketSerializer packetSerializer = new PacketSerializer(EnumPacketDirection.CLIENTBOUND);
private static final byte[] uniqueBytes = new byte[]{0, 1, 1, 2, 3, 5, 8};
public static File getRenderFolder() throws IOException {
@@ -98,18 +96,6 @@ public class ReplayFileIO {
}
}
public static byte[] serializePacket(Packet packet) {
ByteBuf bb = Unpooled.buffer();
packetSerializer.encode(EnumConnectionState.PLAY, packet, bb);
bb.readerIndex(0);
byte[] array = new byte[bb.readableBytes()];
bb.readBytes(array);
bb.readerIndex(0);
return array;
}
private static final Gson gson = new Gson();
private static void write(Object obj, File file) throws IOException {