Skip to content

Commit

Permalink
Savety features
Browse files Browse the repository at this point in the history
  • Loading branch information
RLLD576 committed Aug 20, 2024
1 parent 2784a22 commit 37e3f8f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/net/rober/mixin/ReplayScreenMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.replaymod.lib.de.johni0702.minecraft.gui.element.GuiElement;
import com.replaymod.replay.gui.screen.GuiReplayViewer;
import com.replaymod.replaystudio.pathing.path.Keyframe;
import com.replaymod.replaystudio.pathing.path.Path;
import com.replaymod.replaystudio.pathing.path.Timeline;
import com.replaymod.replaystudio.replay.ZipReplayFile;
import com.replaymod.replaystudio.studio.ReplayStudio;
Expand Down Expand Up @@ -47,7 +48,6 @@ private void addButtonMixin(Args args) {
try {
GuiReplayViewer.GuiReplayEntry entry = list.getSelected().get(0);
ZipReplayFile replayFile = new ZipReplayFile(new ReplayStudio(),entry.file);
ReplayInterpolator.LOGGER.info(replayFile.getMetaData().getDuration());
Timeline timeline = replayFile.getTimelines(new SPTimeline()).get("");
SPTimeline spTimeline = new SPTimeline(timeline);
Collection<Keyframe> keyframes = spTimeline.getPath(SPTimeline.SPPath.POSITION).getKeyframes();
Expand Down Expand Up @@ -81,6 +81,17 @@ private void addButtonMixin(Args args) {

}
spTimeline = new SPTimeline(cameraTimeline);
Path timePath = spTimeline.getPath(SPTimeline.SPPath.TIME);
if(!timePath.getKeyframes().isEmpty()){
List<Long> toDelete = new LinkedList<>();
for (Keyframe keyframe : timePath.getKeyframes()) {
toDelete.add(keyframe.getTime());
}
for (Long l : toDelete) {
spTimeline.removeTimeKeyframe(l);
}

}
spTimeline.addTimeKeyframe(timePassed,3000);
timePassed+= timelapseDuration;
spTimeline.addTimeKeyframe(timePassed, (int) (replayDuration+3000));
Expand Down

0 comments on commit 37e3f8f

Please sign in to comment.