Fix all warnings
Add and make use of Lombok Remove Mojang API Remove ZipFileUtils Remove StreamTools in favor of Apache IOUtils Keyframe should be abstract all derivatives final Replace clone in Keyframe with copy Move some constants from GuiReplaySetttings to GuiConstants
This commit is contained in:
@@ -27,8 +27,4 @@ public class OpenEmbeddedChannel extends EmbeddedChannel {
|
||||
}
|
||||
return pipeline().close();
|
||||
}
|
||||
|
||||
public ChannelFuture manualClose() {
|
||||
return pipeline().close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ReplayHandler {
|
||||
try {
|
||||
File tempFile = File.createTempFile(ReplayFile.ENTRY_PATHS, "json");
|
||||
|
||||
ReplayFileIO.writeKeyframeRegistryToFile(repo, tempFile);
|
||||
ReplayFileIO.write(repo, tempFile);
|
||||
|
||||
ReplayMod.replayFileAppender.registerModifiedFile(tempFile, ReplayFile.ENTRY_PATHS, getReplayFile());
|
||||
} catch(Exception e) {
|
||||
@@ -82,15 +82,13 @@ public class ReplayHandler {
|
||||
for(Keyframe kf : new ArrayList<Keyframe>(keyframes)) {
|
||||
if(kf instanceof MarkerKeyframe) keyframes.remove(kf);
|
||||
}
|
||||
for(MarkerKeyframe marker : m) {
|
||||
keyframes.add(marker);
|
||||
}
|
||||
Collections.addAll(keyframes, m);
|
||||
|
||||
if(write) {
|
||||
try {
|
||||
File tempFile = File.createTempFile(ReplayFile.ENTRY_MARKERS, "json");
|
||||
|
||||
ReplayFileIO.writeMarkersToFile(m, tempFile);
|
||||
ReplayFileIO.write(m, tempFile);
|
||||
|
||||
ReplayMod.replayFileAppender.registerModifiedFile(tempFile, ReplayFile.ENTRY_MARKERS, getReplayFile());
|
||||
} catch(Exception e) {
|
||||
@@ -110,9 +108,7 @@ public class ReplayHandler {
|
||||
|
||||
keyframes = new ArrayList<Keyframe>(Arrays.asList(kfs));
|
||||
|
||||
for(MarkerKeyframe mk : markers) {
|
||||
keyframes.add(mk);
|
||||
}
|
||||
Collections.addAll(keyframes, markers);
|
||||
|
||||
if(!(selectedKeyframe instanceof MarkerKeyframe)) selectedKeyframe = null;
|
||||
|
||||
@@ -460,9 +456,7 @@ public class ReplayHandler {
|
||||
keyframes = new ArrayList<Keyframe>();
|
||||
|
||||
if(!resetMarkers) {
|
||||
for(MarkerKeyframe mk : markers) {
|
||||
keyframes.add(mk);
|
||||
}
|
||||
Collections.addAll(keyframes, markers);
|
||||
|
||||
if(!(selectedKeyframe instanceof MarkerKeyframe))
|
||||
selectKeyframe(null);
|
||||
@@ -540,7 +534,9 @@ public class ReplayHandler {
|
||||
|
||||
try {
|
||||
ReplayMod.overlay.resetUI(true);
|
||||
} catch(Exception e) {} // TODO proper handling
|
||||
} catch(Exception e) {
|
||||
// TODO: Fix exceptionsudo
|
||||
}
|
||||
|
||||
//Load lighting and trigger update
|
||||
ReplayMod.replaySettings.setLightingEnabled(ReplayMod.replaySettings.isLightingEnabled());
|
||||
@@ -594,7 +590,7 @@ public class ReplayHandler {
|
||||
currentReplayFile.close();
|
||||
|
||||
File markerFile = File.createTempFile(ReplayFile.ENTRY_MARKERS, "json");
|
||||
ReplayFileIO.writeMarkersToFile(getMarkers(), markerFile);
|
||||
ReplayFileIO.write(getMarkers(), markerFile);
|
||||
ReplayMod.replayFileAppender.registerModifiedFile(markerFile, ReplayFile.ENTRY_MARKERS, ReplayHandler.getReplayFile());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -673,18 +669,6 @@ public class ReplayHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PositionKeyframe getLastPositionKeyframe() {
|
||||
ArrayList<Keyframe> rev = new ArrayList<Keyframe>(getKeyframes());
|
||||
Collections.reverse(rev);
|
||||
|
||||
for(Keyframe k : rev) {
|
||||
if(k instanceof PositionKeyframe) {
|
||||
return (PositionKeyframe)k;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void syncTimeCursor(boolean shiftMode) {
|
||||
selectKeyframe(null);
|
||||
|
||||
|
||||
@@ -21,21 +21,15 @@ public class ReplayProcess {
|
||||
|
||||
private static Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private static long startRealTime;
|
||||
private static int lastRealReplayTime;
|
||||
private static long lastRealTime = 0;
|
||||
|
||||
private static boolean linear = false;
|
||||
|
||||
private static Position lastPosition = null;
|
||||
private static int lastTimestamp = -1;
|
||||
|
||||
private static SplinePoint motionSpline = null;
|
||||
private static LinearPoint motionLinear = null;
|
||||
private static LinearTimestamp timeLinear = null;
|
||||
|
||||
private static double lastSpeed = 1f;
|
||||
|
||||
private static double previousReplaySpeed = 0;
|
||||
|
||||
private static boolean calculated = false;
|
||||
@@ -44,9 +38,6 @@ public class ReplayProcess {
|
||||
private static boolean blocked = false;
|
||||
private static boolean deepBlock = false;
|
||||
private static boolean requestFinish = false;
|
||||
private static float lastPartialTicks, lastRenderPartialTicks;
|
||||
private static int lastTicks;
|
||||
private static boolean resetTimer = false;
|
||||
private static boolean firstTime = false;
|
||||
|
||||
public static boolean isVideoRecording() {
|
||||
@@ -56,7 +47,6 @@ public class ReplayProcess {
|
||||
private static void resetProcess() {
|
||||
firstTime = true;
|
||||
|
||||
lastPosition = null;
|
||||
motionSpline = null;
|
||||
motionLinear = null;
|
||||
timeLinear = null;
|
||||
@@ -65,11 +55,8 @@ public class ReplayProcess {
|
||||
|
||||
blocked = deepBlock = false;
|
||||
|
||||
startRealTime = System.currentTimeMillis();
|
||||
lastRealTime = startRealTime;
|
||||
lastRealTime = System.currentTimeMillis();
|
||||
lastRealReplayTime = 0;
|
||||
lastTimestamp = -1;
|
||||
lastSpeed = 1f;
|
||||
linear = ReplayMod.replaySettings.isLinearMovement();
|
||||
|
||||
previousReplaySpeed = ReplayMod.replaySender.getReplaySpeed();
|
||||
@@ -162,9 +149,6 @@ public class ReplayProcess {
|
||||
|
||||
if(firstTime) {
|
||||
firstTime = false;
|
||||
lastPartialTicks = 100;
|
||||
lastRenderPartialTicks = 100;
|
||||
lastTicks = 100;
|
||||
mc.timer.renderPartialTicks = 100;
|
||||
mc.timer.elapsedPartialTicks = 100;
|
||||
mc.timer.elapsedTicks = 100;
|
||||
@@ -278,9 +262,7 @@ public class ReplayProcess {
|
||||
}
|
||||
|
||||
if(!(nextTime == null || lastTime == null)) {
|
||||
if(lastTimeStamp == nextTimeStamp) curSpeed = 0f;
|
||||
else
|
||||
curSpeed = ((double) ((nextTime.getTimestamp() - lastTime.getTimestamp()))) / ((double) ((nextTimeStamp - lastTimeStamp)));
|
||||
curSpeed = ((double) ((nextTime.getTimestamp() - lastTime.getTimestamp()))) / ((double) ((nextTimeStamp - lastTimeStamp)));
|
||||
}
|
||||
|
||||
if(lastTimeStamp == nextTimeStamp) {
|
||||
@@ -315,7 +297,9 @@ public class ReplayProcess {
|
||||
}
|
||||
} else {
|
||||
if(posCount == 1) {
|
||||
pos = ReplayHandler.getFirstPositionKeyframe().getPosition();
|
||||
PositionKeyframe keyframe = ReplayHandler.getFirstPositionKeyframe();
|
||||
assert keyframe != null;
|
||||
pos = keyframe.getPosition();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,11 +318,6 @@ public class ReplayProcess {
|
||||
|
||||
if(!isVideoRecording()) ReplayMod.replaySender.setReplaySpeed(curSpeed);
|
||||
//if(curSpeed > 0)
|
||||
lastSpeed = curSpeed;
|
||||
|
||||
lastPartialTicks = mc.timer.elapsedPartialTicks;
|
||||
lastRenderPartialTicks = mc.timer.renderPartialTicks;
|
||||
lastTicks = mc.timer.elapsedTicks;
|
||||
|
||||
if(curTimestamp != null)
|
||||
ReplayMod.replaySender.sendPacketsTill(curTimestamp);
|
||||
|
||||
@@ -291,10 +291,6 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
if(p instanceof S03PacketTimeUpdate) {
|
||||
p = TimeHandler.getTimePacket((S03PacketTimeUpdate) p);
|
||||
}
|
||||
|
||||
if(p instanceof S48PacketResourcePackSend) {
|
||||
S48PacketResourcePackSend packet = (S48PacketResourcePackSend) p;
|
||||
String url = packet.func_179783_a();
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package eu.crushedpixel.replaymod.replay;
|
||||
|
||||
import net.minecraft.network.play.server.S03PacketTimeUpdate;
|
||||
|
||||
public class TimeHandler {
|
||||
|
||||
private static long actualDaytime;
|
||||
private static long desiredDaytime;
|
||||
|
||||
private static boolean timeOverridden = false;
|
||||
|
||||
public static boolean isTimeOverridden() {
|
||||
return timeOverridden;
|
||||
}
|
||||
|
||||
public static void setTimeOverridden(boolean overridden) {
|
||||
timeOverridden = overridden;
|
||||
}
|
||||
|
||||
public static void setDesiredDaytime(long ddt) {
|
||||
desiredDaytime = ddt;
|
||||
}
|
||||
|
||||
public static S03PacketTimeUpdate getTimePacket(S03PacketTimeUpdate packet) {
|
||||
if(!timeOverridden) return packet;
|
||||
return new S03PacketTimeUpdate(packet.func_149366_c(), desiredDaytime, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user