Refactor simple pathing timeline logic into dedicated class with unit tests

Fix logic for user-set interpolators
This commit is contained in:
johni0702
2017-01-21 13:28:14 +01:00
parent cd16211309
commit 2c64030459
9 changed files with 1546 additions and 616 deletions

View File

@@ -9,10 +9,10 @@ import com.replaymod.replaystudio.pathing.interpolation.Interpolator;
import com.replaymod.replaystudio.pathing.path.Keyframe;
import com.replaymod.replaystudio.pathing.path.Path;
import com.replaymod.replaystudio.pathing.path.PathSegment;
import com.replaymod.replaystudio.pathing.path.Timeline;
import com.replaymod.replaystudio.util.EntityPositionTracker;
import com.replaymod.replaystudio.util.Location;
import com.replaymod.simplepathing.ReplayModSimplePathing;
import com.replaymod.simplepathing.SPTimeline;
import com.replaymod.simplepathing.gui.GuiPathing;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
@@ -67,11 +67,11 @@ public class PathPreviewRenderer {
if (guiPathing == null) return;
EntityPositionTracker entityTracker = guiPathing.getEntityTracker();
Timeline timeline = mod.getCurrentTimeline();
SPTimeline timeline = mod.getCurrentTimeline();
if (timeline == null) return;
Path path = timeline.getPaths().get(GuiPathing.POSITION_PATH);
Path path = timeline.getPositionPath();
if (path.getKeyframes().isEmpty()) return;
Path timePath = timeline.getPaths().get(GuiPathing.TIME_PATH);
Path timePath = timeline.getTimePath();
path.update();
@@ -230,7 +230,7 @@ public class PathPreviewRenderer {
float posY = 0f;
float size = 10f / ReplayMod.TEXTURE_SIZE;
if (keyframe == mod.getSelectedKeyframe()) {
if (mod.isSelected(keyframe)) {
posY += size;
}