From 4cf44b91f8b8d55929156690d728b3428d86be21 Mon Sep 17 00:00:00 2001 From: johni0702 Date: Wed, 6 Apr 2016 10:14:28 +0200 Subject: [PATCH] Fix (de)serialization of CubicSplineInterpolator in SimplePathing --- .../replaymod/simplepathing/ReplayModSimplePathing.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/replaymod/simplepathing/ReplayModSimplePathing.java b/src/main/java/com/replaymod/simplepathing/ReplayModSimplePathing.java index ba7c63ec..2475c5d5 100644 --- a/src/main/java/com/replaymod/simplepathing/ReplayModSimplePathing.java +++ b/src/main/java/com/replaymod/simplepathing/ReplayModSimplePathing.java @@ -6,6 +6,7 @@ import com.replaymod.core.ReplayMod; import com.replaymod.pathing.PathingRegistry; import com.replaymod.pathing.impl.TimelineImpl; import com.replaymod.pathing.interpolation.AbstractInterpolator; +import com.replaymod.pathing.interpolation.CubicSplineInterpolator; import com.replaymod.pathing.interpolation.Interpolator; import com.replaymod.pathing.interpolation.LinearInterpolator; import com.replaymod.pathing.path.Keyframe; @@ -87,6 +88,8 @@ public class ReplayModSimplePathing implements PathingRegistry { public void serializeInterpolator(JsonWriter writer, Interpolator interpolator) throws IOException { if (interpolator instanceof LinearInterpolator) { writer.value("linear"); + } else if (interpolator instanceof CubicSplineInterpolator) { + writer.value("cubic-spline"); } else { throw new IOException("Unknown interpolator type: " + interpolator); } @@ -103,6 +106,10 @@ public class ReplayModSimplePathing implements PathingRegistry { interpolator.registerProperty(CameraProperties.POSITION); interpolator.registerProperty(CameraProperties.ROTATION); return interpolator; + case "cubic-spline": + interpolator = new CubicSplineInterpolator(); + interpolator.registerProperty(CameraProperties.POSITION); + interpolator.registerProperty(CameraProperties.ROTATION); default: throw new IOException("Unknown interpolation type: " + type);