Included Path Interpolation methods in KeyframeList and uses it in PathPreviewRenderer

Created newInstance() method in KeyframeValue interface
This commit is contained in:
CrushedPixel
2015-07-08 23:55:48 +02:00
parent cd27ccd855
commit 16b74d9824
12 changed files with 97 additions and 77 deletions

View File

@@ -13,7 +13,7 @@ public class Keyframe<T extends KeyframeValue> {
private int realTimestamp;
private T value;
public Keyframe copy() {
public Keyframe<T> copy() {
return new Keyframe<T>(realTimestamp, value);
}
}

View File

@@ -7,9 +7,13 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
public class Point extends KeyframeValue {
public class Point implements KeyframeValue {
@Interpolate
public double x, y;
@Override
public Point newInstance() {
return new Point();
}
}

View File

@@ -4,7 +4,6 @@ import eu.crushedpixel.replaymod.interpolation.Interpolate;
import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
@@ -12,8 +11,7 @@ import net.minecraft.entity.Entity;
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper=true)
public class Position extends KeyframeValue {
public class Position implements KeyframeValue {
@Interpolate
public double x, y, z;
@@ -44,4 +42,9 @@ public class Position extends KeyframeValue {
double dz = this.z - z;
return dx * dx + dy * dy + dz * dz;
}
@Override
public Position newInstance() {
return new Position();
}
}

View File

@@ -7,9 +7,14 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
public class TimestampValue extends KeyframeValue {
public class TimestampValue implements KeyframeValue {
@Interpolate
public double value;
@Override
public TimestampValue newInstance() {
return new TimestampValue();
}
}