Fixed two similar time keyframes not setting the Replay Speed to 0 sometimes
This commit is contained in:
@@ -115,7 +115,6 @@ public class ReplayMod
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
boolean auth = false;
|
||||
try {
|
||||
|
||||
@@ -288,7 +288,7 @@ public class GuiReplayOverlay extends Gui {
|
||||
ReplayHandler.setLastPosition(null);
|
||||
}
|
||||
|
||||
ReplayHandler.setReplayPos((int)time);
|
||||
ReplayHandler.setReplayTime((int)time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,12 +119,12 @@ public class ReplayHandler {
|
||||
return cameraEntity;
|
||||
}
|
||||
|
||||
public static int getReplayTime() {
|
||||
if(replaySender != null) {
|
||||
return (int)replaySender.currentTimeStamp();
|
||||
public static int getDesiredTimestamp() {
|
||||
return replaySender == null ? 0 : (int)replaySender.getDesiredTimestamp();
|
||||
}
|
||||
|
||||
return 0;
|
||||
public static int getReplayTime() {
|
||||
return replaySender == null ? 0 : (int)replaySender.currentTimeStamp();
|
||||
}
|
||||
|
||||
public static void sortKeyframes() {
|
||||
@@ -279,7 +279,7 @@ public class ReplayHandler {
|
||||
selectKeyframe(null);
|
||||
}
|
||||
|
||||
public static void setReplayPos(int pos) {
|
||||
public static void setReplayTime(int pos) {
|
||||
if(replaySender != null) {
|
||||
replaySender.jumpToTime(pos);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ReplayProcess {
|
||||
if(ts < ReplayHandler.getReplayTime()) {
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
}
|
||||
ReplayHandler.setReplayPos(ts);
|
||||
ReplayHandler.setReplayTime(ts);
|
||||
}
|
||||
|
||||
ChatMessageRequests.addChatMessage("Replay started!", ChatMessageType.INFORMATION);
|
||||
@@ -235,9 +235,13 @@ public class ReplayProcess {
|
||||
int lastTimeStamp = 0;
|
||||
int nextTimeStamp = 0;
|
||||
|
||||
double curSpeed = 0f;
|
||||
double curSpeed = 0;
|
||||
|
||||
if(timeCount > 1 && (nextTime != null || lastTime != null)) {
|
||||
|
||||
if(nextTime != null && lastTime != null && nextTime.getRealTimestamp() == lastTime.getRealTimestamp()) {
|
||||
curSpeed = 0;
|
||||
} else {
|
||||
if(nextTime != null) {
|
||||
nextTimeStamp = nextTime.getRealTimestamp();
|
||||
} else {
|
||||
@@ -259,6 +263,7 @@ public class ReplayProcess {
|
||||
curSpeed = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int currentPosDiff = nextPosStamp - lastPosStamp;
|
||||
int currentPos = curRealReplayTime - lastPosStamp;
|
||||
@@ -302,7 +307,7 @@ public class ReplayProcess {
|
||||
EnchantmentTimer.increaseRecordingTime((1000/ReplayMod.replaySettings.getVideoFramerate()));
|
||||
}
|
||||
|
||||
if(curPos != null) ReplayHandler.setReplayPos(curPos);
|
||||
if(curPos != null && curPos != ReplayHandler.getDesiredTimestamp()) ReplayHandler.setReplayTime(curPos);
|
||||
|
||||
//splinePos = (index of last entry + add) / total entries
|
||||
|
||||
@@ -331,7 +336,6 @@ public class ReplayProcess {
|
||||
}
|
||||
|
||||
if((splinePos >= 1 || posCount <= 1) && (timePos >= 1 || timeCount <= 1)) {
|
||||
System.out.println(timePos+" | "+timeCount);
|
||||
requestFinish = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,6 +145,10 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
public long getDesiredTimestamp() {
|
||||
return desiredTimeStamp;
|
||||
}
|
||||
|
||||
public void jumpToTime(int millis) {
|
||||
setReplaySpeed(replaySpeed);
|
||||
|
||||
|
||||
@@ -179,6 +179,7 @@ public class ReplayFileIO {
|
||||
}
|
||||
|
||||
public static Packet deserializePacket(byte[] bytes) throws InstantiationException, IllegalAccessException, IOException {
|
||||
try {
|
||||
ByteBuf bb = Unpooled.wrappedBuffer(bytes);
|
||||
PacketBuffer pb = new PacketBuffer(bb);
|
||||
|
||||
@@ -188,6 +189,9 @@ public class ReplayFileIO {
|
||||
p.readPacketData(pb);
|
||||
|
||||
return p;
|
||||
} catch(Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] serializePacket(Packet packet) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user