From 4586cb53820730cee3c910f2f8e218a5a171e5a3 Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Wed, 15 Apr 2020 17:40:26 +0200 Subject: [PATCH] Only update timeline when default iterp type changed (fixes #127) --- src/main/java/com/replaymod/simplepathing/SPTimeline.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/replaymod/simplepathing/SPTimeline.java b/src/main/java/com/replaymod/simplepathing/SPTimeline.java index b3ab522c..830291a8 100644 --- a/src/main/java/com/replaymod/simplepathing/SPTimeline.java +++ b/src/main/java/com/replaymod/simplepathing/SPTimeline.java @@ -105,9 +105,12 @@ public class SPTimeline implements PathingRegistry { public void setDefaultInterpolatorType(InterpolatorType defaultInterpolatorType) { Validate.isTrue(defaultInterpolatorType != InterpolatorType.DEFAULT, "Must not be DEFAULT"); + InterpolatorType prevType = this.defaultInterpolatorType; this.defaultInterpolatorType = Validate.notNull(defaultInterpolatorType); - timeline.pushChange(updateInterpolators()); + if (prevType != null && prevType != this.defaultInterpolatorType) { + timeline.pushChange(updateInterpolators()); + } } public Change setDefaultInterpolator(Interpolator interpolator) {