Skip to content

Commit

Permalink
Fix duration of the playback defined upon starting playback (reported…
Browse files Browse the repository at this point in the history
… by Ник and Andruxioid)
  • Loading branch information
mchorse committed Feb 6, 2021
1 parent 8663a35 commit 545cb4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
11 changes: 3 additions & 8 deletions src/main/java/mchorse/aperture/camera/CameraRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ public class CameraRunner
*/
private boolean isRunning = false;

/**
* The duration of camera profile
*/
private long duration;

/**
* Camera profile which is getting currently played
*/
Expand Down Expand Up @@ -132,7 +127,6 @@ public void start(CameraProfile profile, long start)
this.position.set(this.mc.player);

this.isRunning = true;
this.duration = this.profile.getDuration();
this.ticks = start;
}

Expand Down Expand Up @@ -202,9 +196,10 @@ public void onRenderTick(RenderTickEvent event)
return;
}

long progress = Math.min(this.ticks, this.duration);
long duration = this.profile.getDuration();
long progress = this.ticks;

if (progress >= this.duration)
if (progress >= duration)
{
this.stop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,9 @@ public void updateSaveButton(CameraProfile profile)
*/
public void updateCameraEditor(EntityPlayer player)
{
this.maxScrub = 0;
this.haveScrubbed = false;

this.updateOverlay();
this.position.set(player);
this.setProfile(ClientProxy.control.currentProfile);
Expand All @@ -707,8 +710,6 @@ public void updateCameraEditor(EntityPlayer player)
GuiIngameForge.renderHotbar = false;
GuiIngameForge.renderCrosshairs = false;

this.maxScrub = 0;
this.haveScrubbed = false;
this.flight.setFlightEnabled(false);
ClientProxy.control.cache();
this.setAspectRatio(Aperture.editorLetterboxAspect.get());
Expand Down

0 comments on commit 545cb4f

Please sign in to comment.