Renamed the commonly used Position POJO into AdvancedPosition, as it also hold pitch, yaw and roll
Made GuiDropdown only accept instances of GuiEntryListEntry to avoid unneccessary toString() methods returning the name Added GuiEntryListValueEntry which holds a Value and a Name to be displayed Continued work on GuiObjectManager
This commit is contained in:
51
src/main/java/eu/crushedpixel/replaymod/holders/AdvancedPosition.java
Executable file
51
src/main/java/eu/crushedpixel/replaymod/holders/AdvancedPosition.java
Executable file
@@ -0,0 +1,51 @@
|
||||
package eu.crushedpixel.replaymod.holders;
|
||||
|
||||
import eu.crushedpixel.replaymod.interpolation.Interpolate;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
public class AdvancedPosition extends Position {
|
||||
|
||||
@Interpolate
|
||||
public double pitch, yaw, roll;
|
||||
|
||||
private Integer spectatedEntityID;
|
||||
|
||||
public AdvancedPosition(double x, double y, double z, double pitch, double yaw, double roll, Integer spectatedEntityID) {
|
||||
super(x, y, z);
|
||||
}
|
||||
|
||||
public AdvancedPosition(int entityID, boolean spectate) {
|
||||
this(Minecraft.getMinecraft().theWorld.getEntityByID(entityID), spectate);
|
||||
}
|
||||
|
||||
public AdvancedPosition(Entity e, boolean spectate) {
|
||||
this(e.posX, e.posY, e.posZ, e.rotationPitch, e.rotationYaw, spectate ? e.getEntityId() : null);
|
||||
}
|
||||
|
||||
public AdvancedPosition(double x, double y, double z, float pitch, float yaw, Integer spectatedEntityID) {
|
||||
this(x, y, z, pitch, yaw, 0, spectatedEntityID);
|
||||
}
|
||||
|
||||
public AdvancedPosition(double x, double y, double z, float pitch, float yaw) {
|
||||
this(x, y, z, pitch, yaw, 0, null);
|
||||
}
|
||||
|
||||
public double distanceSquared(double x, double y, double z) {
|
||||
double dx = this.x - x;
|
||||
double dy = this.y - y;
|
||||
double dz = this.z - z;
|
||||
return dx * dx + dy * dy + dz * dz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdvancedPosition newInstance() {
|
||||
return new AdvancedPosition();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package eu.crushedpixel.replaymod.holders;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class GuiEntryListValueEntry<T> implements GuiEntryListEntry {
|
||||
|
||||
String displayString;
|
||||
T value;
|
||||
|
||||
@Override
|
||||
public String getDisplayString() {
|
||||
return displayString;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
public class KeyframeSet implements GuiEntryListEntry {
|
||||
private String name;
|
||||
private Keyframe<Position>[] positionKeyframes;
|
||||
private Keyframe<AdvancedPosition>[] positionKeyframes;
|
||||
private Keyframe<TimestampValue>[] timeKeyframes;
|
||||
|
||||
public KeyframeSet(String name, Keyframe[] keyframes) {
|
||||
@@ -21,12 +21,12 @@ public class KeyframeSet implements GuiEntryListEntry {
|
||||
}
|
||||
|
||||
public void setKeyframes(Keyframe[] keyframes) {
|
||||
List<Keyframe<Position>> posKFList = new ArrayList<Keyframe<Position>>();
|
||||
List<Keyframe<AdvancedPosition>> posKFList = new ArrayList<Keyframe<AdvancedPosition>>();
|
||||
List<Keyframe<TimestampValue>> timeKFList = new ArrayList<Keyframe<TimestampValue>>();
|
||||
|
||||
for(Keyframe kf : keyframes) {
|
||||
if(kf.getValue() instanceof Position)
|
||||
posKFList.add((Keyframe<Position>)kf);
|
||||
if(kf.getValue() instanceof AdvancedPosition)
|
||||
posKFList.add((Keyframe<AdvancedPosition>)kf);
|
||||
else if(kf.getValue() instanceof TimestampValue)
|
||||
timeKFList.add((Keyframe<TimestampValue>) kf);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import lombok.Data;
|
||||
public class MarkerKeyframe {
|
||||
|
||||
private int realTimestamp;
|
||||
private Position position;
|
||||
private AdvancedPosition position;
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package eu.crushedpixel.replaymod.holders;
|
||||
|
||||
import eu.crushedpixel.replaymod.interpolation.Interpolate;
|
||||
import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class NumberValue implements KeyframeValue {
|
||||
|
||||
@Interpolate
|
||||
public double value;
|
||||
|
||||
@Override
|
||||
public NumberValue newInstance() {
|
||||
return new NumberValue();
|
||||
}
|
||||
|
||||
}
|
||||
30
src/main/java/eu/crushedpixel/replaymod/holders/Position.java
Executable file → Normal file
30
src/main/java/eu/crushedpixel/replaymod/holders/Position.java
Executable file → Normal file
@@ -5,8 +5,6 @@ import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@@ -15,36 +13,10 @@ public class Position implements KeyframeValue {
|
||||
|
||||
@Interpolate
|
||||
public double x, y, z;
|
||||
@Interpolate
|
||||
public double pitch, yaw, roll;
|
||||
|
||||
private Integer spectatedEntityID;
|
||||
|
||||
public Position(int entityID, boolean spectate) {
|
||||
this(Minecraft.getMinecraft().theWorld.getEntityByID(entityID), spectate);
|
||||
}
|
||||
|
||||
public Position(Entity e, boolean spectate) {
|
||||
this(e.posX, e.posY, e.posZ, e.rotationPitch, e.rotationYaw, spectate ? e.getEntityId() : null);
|
||||
}
|
||||
|
||||
public Position(double x, double y, double z, float pitch, float yaw, Integer spectatedEntityID) {
|
||||
this(x, y, z, pitch, yaw, 0, spectatedEntityID);
|
||||
}
|
||||
|
||||
public Position(double x, double y, double z, float pitch, float yaw) {
|
||||
this(x, y, z, pitch, yaw, 0, null);
|
||||
}
|
||||
|
||||
public double distanceSquared(double x, double y, double z) {
|
||||
double dx = this.x - x;
|
||||
double dy = this.y - y;
|
||||
double dz = this.z - z;
|
||||
return dx * dx + dy * dy + dz * dz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Position newInstance() {
|
||||
return new Position();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package eu.crushedpixel.replaymod.holders;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Transformation {
|
||||
|
||||
private Position anchor;
|
||||
private Position position;
|
||||
private Position orientation;
|
||||
private Position scale;
|
||||
private double opacity;
|
||||
|
||||
private float width, height;
|
||||
|
||||
}
|
||||
@@ -1,20 +1,19 @@
|
||||
package eu.crushedpixel.replaymod.holders;
|
||||
|
||||
import eu.crushedpixel.replaymod.interpolation.KeyframeList;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Transformations {
|
||||
|
||||
private Position anchor;
|
||||
private Position position;
|
||||
private Position orientation;
|
||||
private Point scale;
|
||||
private float opacity;
|
||||
private KeyframeList<Position> anchorKeyframes, positionKeyframes,
|
||||
orientationKeyframes, scaleKeyframes;
|
||||
private KeyframeList<NumberValue> opacityKeyframes;
|
||||
|
||||
private float width, height;
|
||||
public Transformation getTransformationForTimestamp(int timestamp) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user