Fix partial render ticks being reset during sync packet sending
This commit is contained in:
@@ -75,12 +75,6 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
*/
|
*/
|
||||||
protected int lastTimeStamp;
|
protected int lastTimeStamp;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the replay has been restarted.
|
|
||||||
* It might be required to advance some ticks in order for rendering to keep up.
|
|
||||||
*/
|
|
||||||
protected boolean hasRestarted;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The replay file.
|
* The replay file.
|
||||||
*/
|
*/
|
||||||
@@ -574,11 +568,6 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
if (isHurrying() && lastTimeStamp > desiredTimeStamp && !startFromBeginning) {
|
if (isHurrying() && lastTimeStamp > desiredTimeStamp && !startFromBeginning) {
|
||||||
desiredTimeStamp = -1;
|
desiredTimeStamp = -1;
|
||||||
|
|
||||||
// Give the render engine a reason to get going
|
|
||||||
MCTimerHandler.advanceRenderPartialTicks(5);
|
|
||||||
MCTimerHandler.advancePartialTicks(5);
|
|
||||||
MCTimerHandler.advanceTicks(5);
|
|
||||||
|
|
||||||
Position pos = ReplayHandler.getLastPosition();
|
Position pos = ReplayHandler.getLastPosition();
|
||||||
CameraEntity cam = ReplayHandler.getCameraEntity();
|
CameraEntity cam = ReplayHandler.getCameraEntity();
|
||||||
if (cam != null && pos != null) {
|
if (cam != null && pos != null) {
|
||||||
@@ -608,7 +597,6 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restart the replay.
|
// Restart the replay.
|
||||||
hasRestarted = true;
|
|
||||||
hasWorldLoaded = false;
|
hasWorldLoaded = false;
|
||||||
lastTimeStamp = 0;
|
lastTimeStamp = 0;
|
||||||
startFromBeginning = false;
|
startFromBeginning = false;
|
||||||
@@ -701,7 +689,6 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (timestamp < lastTimeStamp) { // Restart the replay if we need to go backwards in time
|
if (timestamp < lastTimeStamp) { // Restart the replay if we need to go backwards in time
|
||||||
hasRestarted = true;
|
|
||||||
hasWorldLoaded = false;
|
hasWorldLoaded = false;
|
||||||
lastTimeStamp = 0;
|
lastTimeStamp = 0;
|
||||||
if (dis != null) {
|
if (dis != null) {
|
||||||
@@ -753,13 +740,6 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
|
|
||||||
// This might be required if we change to async mode anytime soon
|
// This might be required if we change to async mode anytime soon
|
||||||
lastPacketSent = System.currentTimeMillis();
|
lastPacketSent = System.currentTimeMillis();
|
||||||
|
|
||||||
// In case we have restarted the replay we have to give the render engine a reason to get going
|
|
||||||
if (hasRestarted) {
|
|
||||||
MCTimerHandler.advanceRenderPartialTicks(5);
|
|
||||||
MCTimerHandler.advancePartialTicks(5);
|
|
||||||
MCTimerHandler.advanceTicks(5);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
Reference in New Issue
Block a user