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