Included Path Interpolation methods in KeyframeList and uses it in PathPreviewRenderer
Created newInstance() method in KeyframeValue interface
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user