Freed mouse during rendering process
Made replay_recordings and replay_videos folder customizable through config file (not recommended)
This commit is contained in:
0
libs/monte-cc.jar
Normal file → Executable file
0
libs/monte-cc.jar
Normal file → Executable file
@@ -32,6 +32,7 @@ import eu.crushedpixel.replaymod.registry.KeybindRegistry;
|
|||||||
import eu.crushedpixel.replaymod.registry.LightingHandler;
|
import eu.crushedpixel.replaymod.registry.LightingHandler;
|
||||||
import eu.crushedpixel.replaymod.renderer.SafeEntityRenderer;
|
import eu.crushedpixel.replaymod.renderer.SafeEntityRenderer;
|
||||||
import eu.crushedpixel.replaymod.settings.ReplaySettings;
|
import eu.crushedpixel.replaymod.settings.ReplaySettings;
|
||||||
|
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||||
|
|
||||||
@Mod(modid = ReplayMod.MODID, version = ReplayMod.VERSION)
|
@Mod(modid = ReplayMod.MODID, version = ReplayMod.VERSION)
|
||||||
public class ReplayMod
|
public class ReplayMod
|
||||||
@@ -135,8 +136,7 @@ public class ReplayMod
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeTmcprFiles() {
|
private void removeTmcprFiles() {
|
||||||
File folder = new File("./replay_recordings/");
|
File folder = ReplayFileIO.getReplayFolder();
|
||||||
folder.mkdirs();
|
|
||||||
|
|
||||||
for(File f : folder.listFiles()) {
|
for(File f : folder.listFiles()) {
|
||||||
if(("."+FilenameUtils.getExtension(f.getAbsolutePath())).equals(ConnectionEventHandler.TEMP_FILE_EXTENSION)) {
|
if(("."+FilenameUtils.getExtension(f.getAbsolutePath())).equals(ConnectionEventHandler.TEMP_FILE_EXTENSION)) {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import eu.crushedpixel.replaymod.holders.TimeKeyframe;
|
|||||||
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
|
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
|
||||||
import eu.crushedpixel.replaymod.registry.ReplayGuiRegistry;
|
import eu.crushedpixel.replaymod.registry.ReplayGuiRegistry;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
|
import eu.crushedpixel.replaymod.replay.ReplayProcess;
|
||||||
import eu.crushedpixel.replaymod.utils.MouseUtils;
|
import eu.crushedpixel.replaymod.utils.MouseUtils;
|
||||||
import eu.crushedpixel.replaymod.video.VideoWriter;
|
import eu.crushedpixel.replaymod.video.VideoWriter;
|
||||||
|
|
||||||
@@ -82,7 +83,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onRenderGui(RenderGameOverlayEvent event) {
|
public void onRenderGui(RenderGameOverlayEvent event) {
|
||||||
if(VideoWriter.isRecording() && !(mc.currentScreen instanceof GuiCancelRender)) {
|
if(ReplayProcess.isVideoRecording() && ReplayHandler.isInPath() && !(mc.currentScreen instanceof GuiCancelRender)) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,10 +114,6 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
|
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
|
||||||
if(!ReplayHandler.isInReplay()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Point mousePoint = MouseUtils.getMousePos();
|
Point mousePoint = MouseUtils.getMousePos();
|
||||||
final int mouseX = (int) mousePoint.getX();
|
final int mouseX = (int) mousePoint.getX();
|
||||||
final int mouseY = (int) mousePoint.getY();
|
final int mouseY = (int) mousePoint.getY();
|
||||||
@@ -250,7 +247,8 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
|
|
||||||
mc.renderEngine.bindTexture(extended_gui);
|
mc.renderEngine.bindTexture(extended_gui);
|
||||||
|
|
||||||
if(hover && Mouse.isButtonDown(0) && isClick() && FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)) {
|
if(hover && Mouse.isButtonDown(0) && isClick() && FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)
|
||||||
|
&& !ReplayHandler.isInPath()) {
|
||||||
if(ReplayHandler.getSelected() == null || !(ReplayHandler.getSelected() instanceof PositionKeyframe)) {
|
if(ReplayHandler.getSelected() == null || !(ReplayHandler.getSelected() instanceof PositionKeyframe)) {
|
||||||
addPlaceKeyframe();
|
addPlaceKeyframe();
|
||||||
} else {
|
} else {
|
||||||
@@ -292,7 +290,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
mc.renderEngine.bindTexture(extended_gui);
|
mc.renderEngine.bindTexture(extended_gui);
|
||||||
|
|
||||||
if(hover && Mouse.isButtonDown(0) && isClick() && FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)) {
|
if(hover && Mouse.isButtonDown(0) && isClick() && FMLClientHandler.instance().isGUIOpen(GuiMouseInput.class)) {
|
||||||
if(ReplayHandler.getSelected() == null || !(ReplayHandler.getSelected() instanceof TimeKeyframe)) {
|
if(ReplayHandler.getSelected() == null || !(ReplayHandler.getSelected() instanceof TimeKeyframe) && !ReplayHandler.isInPath()) {
|
||||||
addTimeKeyframe();
|
addTimeKeyframe();
|
||||||
} else {
|
} else {
|
||||||
ReplayHandler.removeKeyframe(ReplayHandler.getSelected());
|
ReplayHandler.removeKeyframe(ReplayHandler.getSelected());
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|||||||
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiCancelRender;
|
import eu.crushedpixel.replaymod.gui.GuiCancelRender;
|
||||||
|
import eu.crushedpixel.replaymod.gui.elements.GuiMouseInput;
|
||||||
import eu.crushedpixel.replaymod.reflection.MCPNames;
|
import eu.crushedpixel.replaymod.reflection.MCPNames;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayProcess;
|
import eu.crushedpixel.replaymod.replay.ReplayProcess;
|
||||||
@@ -70,13 +71,32 @@ public class TickAndRenderListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//private boolean f1Down = false;
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void tick(TickEvent event) {
|
public void tick(TickEvent event) {
|
||||||
if(!ReplayHandler.isInReplay()) return;
|
if(!ReplayHandler.isInReplay()) return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
if(Keyboard.getEventKeyState() && Keyboard.isKeyDown(Keyboard.KEY_F1)
|
||||||
|
&& ReplayHandler.isInPath() && !ReplayProcess.isVideoRecording()
|
||||||
|
&& mc.currentScreen instanceof GuiMouseInput && !f1Down) {
|
||||||
|
mc.gameSettings.hideGUI = !mc.gameSettings.hideGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
f1Down = Keyboard.isKeyDown(Keyboard.KEY_F1) && Keyboard.getEventKeyState();
|
||||||
|
*/
|
||||||
|
|
||||||
if(ReplayHandler.getCameraEntity() != null)
|
if(ReplayHandler.getCameraEntity() != null)
|
||||||
ReplayHandler.getCameraEntity().updateMovement();
|
ReplayHandler.getCameraEntity().updateMovement();
|
||||||
if(ReplayHandler.isInPath()) ReplayProcess.unblockAndTick(true);
|
if(ReplayHandler.isInPath()) {
|
||||||
if(!ReplayHandler.isInPath()) onMouseMove(new MouseEvent());
|
ReplayProcess.unblockAndTick(true);
|
||||||
|
if(ReplayProcess.isVideoRecording() &&
|
||||||
|
!(mc.currentScreen instanceof GuiMouseInput || mc.currentScreen instanceof GuiCancelRender)) {
|
||||||
|
mc.displayGuiScreen(new GuiMouseInput());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else onMouseMove(new MouseEvent());
|
||||||
FMLCommonHandler.instance().bus().post(new InputEvent.KeyInputEvent());
|
FMLCommonHandler.instance().bus().post(new InputEvent.KeyInputEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +115,7 @@ public class TickAndRenderListener {
|
|||||||
Mouse.setGrabbed(true);
|
Mouse.setGrabbed(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mc.inGameHasFocus && flag)
|
if (mc.inGameHasFocus && flag && !(ReplayHandler.isInPath()))
|
||||||
{
|
{
|
||||||
mc.mouseHelper.mouseXYChange();
|
mc.mouseHelper.mouseXYChange();
|
||||||
float f1 = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
|
float f1 = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.apache.commons.io.FilenameUtils;
|
|||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
|
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
|
||||||
|
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||||
|
|
||||||
public class GuiRenameReplay extends GuiScreen
|
public class GuiRenameReplay extends GuiScreen
|
||||||
{
|
{
|
||||||
@@ -59,8 +60,8 @@ public class GuiRenameReplay extends GuiScreen
|
|||||||
}
|
}
|
||||||
else if (button.id == 0)
|
else if (button.id == 0)
|
||||||
{
|
{
|
||||||
File folder = new File("./replay_recordings/");
|
File folder = ReplayFileIO.getReplayFolder();
|
||||||
folder.mkdirs();
|
|
||||||
File initRenamed = new File(folder, this.field_146583_f.getText().trim()+ConnectionEventHandler.ZIP_FILE_EXTENSION.replaceAll("[^a-zA-Z0-9\\.\\-]", "_"));
|
File initRenamed = new File(folder, this.field_146583_f.getText().trim()+ConnectionEventHandler.ZIP_FILE_EXTENSION.replaceAll("[^a-zA-Z0-9\\.\\-]", "_"));
|
||||||
File renamed = initRenamed;
|
File renamed = initRenamed;
|
||||||
int i=1;
|
int i=1;
|
||||||
|
|||||||
@@ -217,8 +217,8 @@ public class GuiReplayViewer extends GuiScreen implements GuiYesNoCallback {
|
|||||||
this.mc.displayGuiScreen(new GuiUploadFile(file, this));
|
this.mc.displayGuiScreen(new GuiUploadFile(file, this));
|
||||||
}
|
}
|
||||||
else if(button.id == FOLDER_BUTTON_ID) {
|
else if(button.id == FOLDER_BUTTON_ID) {
|
||||||
File file1 = new File("./replay_recordings/");
|
File file1 = ReplayFileIO.getReplayFolder();
|
||||||
file1.mkdirs();
|
|
||||||
String s = file1.getAbsolutePath();
|
String s = file1.getAbsolutePath();
|
||||||
|
|
||||||
if(Util.getOSType() == Util.EnumOS.OSX) {
|
if(Util.getOSType() == Util.EnumOS.OSX) {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientDisconnection
|
|||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.chat.ChatMessageRequests;
|
import eu.crushedpixel.replaymod.chat.ChatMessageRequests;
|
||||||
import eu.crushedpixel.replaymod.chat.ChatMessageRequests.ChatMessageType;
|
import eu.crushedpixel.replaymod.chat.ChatMessageRequests.ChatMessageType;
|
||||||
|
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||||
|
|
||||||
public class ConnectionEventHandler {
|
public class ConnectionEventHandler {
|
||||||
|
|
||||||
@@ -94,8 +95,7 @@ public class ConnectionEventHandler {
|
|||||||
channelHandlerKeys.add(entry.getKey());
|
channelHandlerKeys.add(entry.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
File folder = new File("./replay_recordings/");
|
File folder = ReplayFileIO.getReplayFolder();
|
||||||
folder.mkdirs();
|
|
||||||
|
|
||||||
fileName = sdf.format(Calendar.getInstance().getTime());
|
fileName = sdf.format(Calendar.getInstance().getTime());
|
||||||
currentFile = new File(folder, fileName+TEMP_FILE_EXTENSION);
|
currentFile = new File(folder, fileName+TEMP_FILE_EXTENSION);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import net.minecraft.client.renderer.ActiveRenderInfo;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiReplaySaving;
|
import eu.crushedpixel.replaymod.gui.GuiReplaySaving;
|
||||||
import eu.crushedpixel.replaymod.holders.PacketData;
|
import eu.crushedpixel.replaymod.holders.PacketData;
|
||||||
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||||
@@ -153,8 +154,7 @@ public abstract class DataListener extends ChannelInboundHandlerAdapter {
|
|||||||
ReplayMetaData metaData = new ReplayMetaData(singleplayer, worldName, (int)lastSentPacket, startTime, pl, mcversion);
|
ReplayMetaData metaData = new ReplayMetaData(singleplayer, worldName, (int)lastSentPacket, startTime, pl, mcversion);
|
||||||
String json = gson.toJson(metaData);
|
String json = gson.toJson(metaData);
|
||||||
|
|
||||||
File folder = new File("./replay_recordings/");
|
File folder = ReplayFileIO.getReplayFolder();
|
||||||
folder.mkdirs();
|
|
||||||
|
|
||||||
File archive = new File(folder, name+ConnectionEventHandler.ZIP_FILE_EXTENSION);
|
File archive = new File(folder, name+ConnectionEventHandler.ZIP_FILE_EXTENSION);
|
||||||
archive.createNewFile();
|
archive.createNewFile();
|
||||||
|
|||||||
@@ -75,7 +75,25 @@ public class ReplaySettings {
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum AdvancedOptions implements ValueEnum {
|
||||||
|
recordingPath("./replay_recordings/"), renderPath("./replay_videos/");
|
||||||
|
|
||||||
|
private Object value;
|
||||||
|
|
||||||
|
public Object getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(Object value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
AdvancedOptions(Object value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<ValueEnum> getValueEnums() {
|
public List<ValueEnum> getValueEnums() {
|
||||||
List<ValueEnum> enums = new ArrayList<ReplaySettings.ValueEnum>();
|
List<ValueEnum> enums = new ArrayList<ReplaySettings.ValueEnum>();
|
||||||
enums.addAll(Arrays.asList(ReplayOptions.values()));
|
enums.addAll(Arrays.asList(ReplayOptions.values()));
|
||||||
@@ -87,23 +105,35 @@ public class ReplaySettings {
|
|||||||
Configuration config = ReplayMod.config;
|
Configuration config = ReplayMod.config;
|
||||||
|
|
||||||
for(RecordingOptions o : RecordingOptions.values()) {
|
for(RecordingOptions o : RecordingOptions.values()) {
|
||||||
Property p = getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "recording");
|
Property p = getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "recording", false);
|
||||||
o.setValue(getValueObject(p));
|
o.setValue(getValueObject(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(ReplayOptions o : ReplayOptions.values()) {
|
for(ReplayOptions o : ReplayOptions.values()) {
|
||||||
Property p = getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "replay");
|
Property p = getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "replay", false);
|
||||||
o.setValue(getValueObject(p));
|
o.setValue(getValueObject(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(RenderOptions o : RenderOptions.values()) {
|
for(RenderOptions o : RenderOptions.values()) {
|
||||||
Property p = getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "render");
|
Property p = getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "render", false);
|
||||||
|
o.setValue(getValueObject(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(AdvancedOptions o : AdvancedOptions.values()) {
|
||||||
|
Property p = getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "advanced", true);
|
||||||
o.setValue(getValueObject(p));
|
o.setValue(getValueObject(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getRecordingPath() {
|
||||||
|
return (String)AdvancedOptions.recordingPath.getValue();
|
||||||
|
}
|
||||||
|
public String getRenderPath() {
|
||||||
|
return (String)AdvancedOptions.renderPath.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
public int getVideoFramerate() {
|
public int getVideoFramerate() {
|
||||||
return (Integer)RenderOptions.videoFramerate.getValue();
|
return (Integer)RenderOptions.videoFramerate.getValue();
|
||||||
}
|
}
|
||||||
@@ -170,7 +200,7 @@ public class ReplaySettings {
|
|||||||
public boolean getWaitForChunks() {
|
public boolean getWaitForChunks() {
|
||||||
return (Boolean)RenderOptions.waitForChunks.getValue();
|
return (Boolean)RenderOptions.waitForChunks.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLightingEnabled(boolean enabled) {
|
public void setLightingEnabled(boolean enabled) {
|
||||||
ReplayOptions.lighting.setValue(enabled);
|
ReplayOptions.lighting.setValue(enabled);
|
||||||
LightingHandler.setLighting(enabled);
|
LightingHandler.setLighting(enabled);
|
||||||
@@ -183,29 +213,52 @@ public class ReplaySettings {
|
|||||||
for(String cat : ReplayMod.instance.config.getCategoryNames()) {
|
for(String cat : ReplayMod.instance.config.getCategoryNames()) {
|
||||||
ReplayMod.instance.config.removeCategory(ReplayMod.instance.config.getCategory(cat));
|
ReplayMod.instance.config.removeCategory(ReplayMod.instance.config.getCategory(cat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(RecordingOptions o : RecordingOptions.values()) {
|
||||||
|
getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "recording", false);
|
||||||
|
}
|
||||||
|
|
||||||
for(ReplayOptions o : ReplayOptions.values()) {
|
for(ReplayOptions o : ReplayOptions.values()) {
|
||||||
getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "replay");
|
getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "replay", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(RenderOptions o : RenderOptions.values()) {
|
for(RenderOptions o : RenderOptions.values()) {
|
||||||
getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "render");
|
getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "render", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(AdvancedOptions o : AdvancedOptions.values()) {
|
||||||
|
getConfigSetting(ReplayMod.instance.config, o.name(), o.getValue(), "advanced", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReplayMod.instance.config.save();
|
ReplayMod.instance.config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Property getConfigSetting(Configuration config, String name, Object value, String category) {
|
private Property getConfigSetting(Configuration config, String name, Object value, String category, boolean warning) {
|
||||||
if(value instanceof Integer) {
|
if(warning) {
|
||||||
return config.get(category, name, (Integer)value);
|
String warningMsg = "Please be careful when modifying this setting, as setting it to an invalid value might harm your computer.";
|
||||||
} else if(value instanceof Boolean) {
|
if(value instanceof Integer) {
|
||||||
return config.get(category, name, (Boolean)value);
|
return config.get(category, name, (Integer)value, warningMsg);
|
||||||
} else if(value instanceof Double) {
|
} else if(value instanceof Boolean) {
|
||||||
return config.get(category, name, (Double)value);
|
return config.get(category, name, (Boolean)value, warningMsg);
|
||||||
} else if(value instanceof Float) {
|
} else if(value instanceof Double) {
|
||||||
return config.get(category, name, (double)(Float)value);
|
return config.get(category, name, (Double)value, warningMsg);
|
||||||
} else if(value instanceof String) {
|
} else if(value instanceof Float) {
|
||||||
return config.get(category, name, (String)value);
|
return config.get(category, name, (double)(Float)value, warningMsg);
|
||||||
|
} else if(value instanceof String) {
|
||||||
|
return config.get(category, name, (String)value, warningMsg);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(value instanceof Integer) {
|
||||||
|
return config.get(category, name, (Integer)value);
|
||||||
|
} else if(value instanceof Boolean) {
|
||||||
|
return config.get(category, name, (Boolean)value);
|
||||||
|
} else if(value instanceof Double) {
|
||||||
|
return config.get(category, name, (Double)value);
|
||||||
|
} else if(value instanceof Float) {
|
||||||
|
return config.get(category, name, (double)(Float)value);
|
||||||
|
} else if(value instanceof String) {
|
||||||
|
return config.get(category, name, (String)value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -216,7 +269,8 @@ public class ReplaySettings {
|
|||||||
return p.getDouble();
|
return p.getDouble();
|
||||||
} else if(p.isBooleanValue()) {
|
} else if(p.isBooleanValue()) {
|
||||||
return p.getBoolean();
|
return p.getBoolean();
|
||||||
|
} else {
|
||||||
|
return p.getString();
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import akka.japi.Pair;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.holders.PacketData;
|
import eu.crushedpixel.replaymod.holders.PacketData;
|
||||||
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
|
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
|
||||||
import eu.crushedpixel.replaymod.recording.PacketSerializer;
|
import eu.crushedpixel.replaymod.recording.PacketSerializer;
|
||||||
@@ -45,8 +46,15 @@ import eu.crushedpixel.replaymod.replay.PacketDeserializer;
|
|||||||
@SuppressWarnings("resource") //Gets handled by finalizer
|
@SuppressWarnings("resource") //Gets handled by finalizer
|
||||||
public class ReplayFileIO {
|
public class ReplayFileIO {
|
||||||
|
|
||||||
|
public static File getRenderFolder() {
|
||||||
|
File folder = new File(ReplayMod.replaySettings.getRenderPath());
|
||||||
|
folder.mkdirs();
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
|
||||||
public static File getReplayFolder() {
|
public static File getReplayFolder() {
|
||||||
File folder = new File("./replay_recordings/");
|
String path = ReplayMod.replaySettings.getRecordingPath();
|
||||||
|
File folder = new File(path);
|
||||||
folder.mkdirs();
|
folder.mkdirs();
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import eu.crushedpixel.replaymod.chat.ChatMessageRequests.ChatMessageType;
|
|||||||
import eu.crushedpixel.replaymod.gui.GuiReplaySaving;
|
import eu.crushedpixel.replaymod.gui.GuiReplaySaving;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
import eu.crushedpixel.replaymod.utils.ImageUtils;
|
import eu.crushedpixel.replaymod.utils.ImageUtils;
|
||||||
|
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||||
|
|
||||||
public class ReplayScreenshot {
|
public class ReplayScreenshot {
|
||||||
|
|
||||||
@@ -93,8 +94,7 @@ public class ReplayScreenshot {
|
|||||||
|
|
||||||
File replayFile = ReplayHandler.getReplayFile();
|
File replayFile = ReplayHandler.getReplayFile();
|
||||||
|
|
||||||
File folder = new File("./replay_recordings/");
|
File folder = ReplayFileIO.getReplayFolder();
|
||||||
folder.mkdirs();
|
|
||||||
|
|
||||||
File temp = File.createTempFile("thumb", null);
|
File temp = File.createTempFile("thumb", null);
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.monte.media.VideoFormatKeys;
|
|||||||
import org.monte.media.math.Rational;
|
import org.monte.media.math.Rational;
|
||||||
|
|
||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
|
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||||
|
|
||||||
public class VideoWriter {
|
public class VideoWriter {
|
||||||
|
|
||||||
@@ -49,8 +50,7 @@ public class VideoWriter {
|
|||||||
toWrite = new LinkedBlockingQueue<BufferedImage>();
|
toWrite = new LinkedBlockingQueue<BufferedImage>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File folder = new File("./replay_videos/");
|
File folder = ReplayFileIO.getRenderFolder();
|
||||||
folder.mkdirs();
|
|
||||||
|
|
||||||
String fileName = sdf.format(Calendar.getInstance().getTime());
|
String fileName = sdf.format(Calendar.getInstance().getTime());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user