Introduce minimal mode (allows RM to run on unsupported MC versions)
by disabling various version-specific features (i.e. everything which requires the ReplayStudio).
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.replaymod.recording.gui;
|
||||
|
||||
import com.replaymod.core.ReplayMod;
|
||||
import com.replaymod.core.utils.Utils;
|
||||
import com.replaymod.editor.gui.MarkerProcessor;
|
||||
import com.replaymod.recording.Setting;
|
||||
import com.replaymod.recording.packet.PacketListener;
|
||||
@@ -32,6 +33,7 @@ public class GuiRecordingControls extends EventRegistrations {
|
||||
private GuiPanel panel = new GuiPanel().setLayout(new HorizontalLayout().setSpacing(4));
|
||||
|
||||
private GuiButton buttonPauseResume = new GuiButton(panel).onClick(() -> {
|
||||
if (Utils.ifMinimalModeDoPopup(panel, () -> {})) return;
|
||||
if (paused) {
|
||||
packetListener.addMarker(MarkerProcessor.MARKER_NAME_END_CUT);
|
||||
} else {
|
||||
@@ -42,6 +44,7 @@ public class GuiRecordingControls extends EventRegistrations {
|
||||
}).setSize(98, 20);
|
||||
|
||||
private GuiButton buttonStartStop = new GuiButton(panel).onClick(() -> {
|
||||
if (Utils.ifMinimalModeDoPopup(panel, () -> {})) return;
|
||||
if (stopped) {
|
||||
paused = false;
|
||||
packetListener.addMarker(MarkerProcessor.MARKER_NAME_END_CUT);
|
||||
|
||||
@@ -122,7 +122,7 @@ public class ConnectionEventHandler {
|
||||
guiOverlay = new GuiRecordingOverlay(mc, core.getSettingsRegistry(), guiControls);
|
||||
guiOverlay.register();
|
||||
|
||||
if (core.getSettingsRegistry().get(Setting.AUTO_START_RECORDING)) {
|
||||
if (core.getSettingsRegistry().get(Setting.AUTO_START_RECORDING) || ReplayMod.isMinimalMode()) {
|
||||
core.printInfoToChat("replaymod.chat.recordingstarted");
|
||||
} else {
|
||||
packetListener.addMarker(MarkerProcessor.MARKER_NAME_START_CUT, 0);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.replaymod.recording.packet;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.replaymod.core.ReplayMod;
|
||||
import com.replaymod.core.utils.Restrictions;
|
||||
import com.replaymod.core.versions.MCVer;
|
||||
import com.replaymod.editor.gui.MarkerProcessor;
|
||||
import com.replaymod.recording.ReplayModRecording;
|
||||
import com.replaymod.recording.Setting;
|
||||
@@ -45,6 +47,7 @@ import net.minecraft.network.NetworkSide;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@@ -112,7 +115,19 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
}
|
||||
try {
|
||||
synchronized (replayFile) {
|
||||
replayFile.writeMetaData(metaData);
|
||||
if (ReplayMod.isMinimalMode()) {
|
||||
metaData.setFileFormat("MCPR");
|
||||
metaData.setFileFormatVersion(ReplayMetaData.CURRENT_FILE_FORMAT_VERSION);
|
||||
metaData.setProtocolVersion(MCVer.getProtocolVersion());
|
||||
metaData.setGenerator("ReplayMod in Minimal Mode");
|
||||
|
||||
try (OutputStream out = replayFile.write("metaData.json")) {
|
||||
String json = (new Gson()).toJson(metaData);
|
||||
out.write(json.getBytes());
|
||||
}
|
||||
} else {
|
||||
replayFile.writeMetaData(metaData);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("Writing metadata:", e);
|
||||
@@ -197,7 +212,7 @@ public class PacketListener extends ChannelInboundHandlerAdapter {
|
||||
replayFile.save();
|
||||
replayFile.close();
|
||||
|
||||
if (core.getSettingsRegistry().get(Setting.AUTO_POST_PROCESS)) {
|
||||
if (core.getSettingsRegistry().get(Setting.AUTO_POST_PROCESS) && !ReplayMod.isMinimalMode()) {
|
||||
MarkerProcessor.apply(outputPath, progress -> {});
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user