Instead of using AdvancedPosition objects with a value for spectatedEntityID, use SpectatorData objects for Spectator Keyframes. This allows us to add more options to Spectator Keyframes.
This commit is contained in:
@@ -18,30 +18,27 @@ 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) {
|
||||
public AdvancedPosition(double x, double y, double z, double pitch, double yaw, double roll) {
|
||||
super(x, y, z);
|
||||
this.pitch = pitch;
|
||||
this.yaw = yaw;
|
||||
this.roll = roll;
|
||||
this.spectatedEntityID = spectatedEntityID;
|
||||
}
|
||||
|
||||
public AdvancedPosition(int entityID, boolean spectate) {
|
||||
this(Minecraft.getMinecraft().theWorld.getEntityByID(entityID), spectate);
|
||||
public AdvancedPosition(int entityID) {
|
||||
this(Minecraft.getMinecraft().theWorld.getEntityByID(entityID));
|
||||
}
|
||||
|
||||
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(Entity e) {
|
||||
this(e.posX, e.posY, e.posZ, e.rotationPitch, e.rotationYaw);
|
||||
}
|
||||
|
||||
public AdvancedPosition(double x, double y, double z, float pitch, float yaw) {
|
||||
this(x, y, z, pitch, yaw, 0, null);
|
||||
this(x, y, z, pitch, yaw, 0);
|
||||
}
|
||||
|
||||
public SpectatorData asSpectatorData(int entityID) {
|
||||
return new SpectatorData(x, y, z, pitch, yaw, roll, entityID);
|
||||
}
|
||||
|
||||
public double distanceSquared(double x, double y, double z) {
|
||||
@@ -62,7 +59,7 @@ public class AdvancedPosition extends Position {
|
||||
|
||||
Vector3d position = new Vector3d(x, y, z);
|
||||
position.add(direction);
|
||||
return new AdvancedPosition(position.x, position.y, position.z, pitch, yaw, roll, null);
|
||||
return new AdvancedPosition(position.x, position.y, position.z, pitch, yaw, roll);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
47
src/main/java/eu/crushedpixel/replaymod/holders/SpectatorData.java
Executable file
47
src/main/java/eu/crushedpixel/replaymod/holders/SpectatorData.java
Executable file
@@ -0,0 +1,47 @@
|
||||
package eu.crushedpixel.replaymod.holders;
|
||||
|
||||
import eu.crushedpixel.replaymod.interpolation.AdvancedPositionLinearInterpolation;
|
||||
import eu.crushedpixel.replaymod.interpolation.AdvancedPositionSplineInterpolation;
|
||||
import eu.crushedpixel.replaymod.interpolation.Interpolation;
|
||||
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 SpectatorData extends AdvancedPosition {
|
||||
|
||||
private int spectatedEntityID;
|
||||
|
||||
public SpectatorData(double x, double y, double z, double pitch, double yaw, double roll, int entityID) {
|
||||
super(x, y, z, pitch, yaw, roll);
|
||||
this.spectatedEntityID = entityID;
|
||||
}
|
||||
|
||||
public SpectatorData(int entityID) {
|
||||
this(Minecraft.getMinecraft().theWorld.getEntityByID(entityID));
|
||||
}
|
||||
|
||||
public SpectatorData(Entity e) {
|
||||
super(e.posX, e.posY, e.posZ, e.rotationPitch, e.rotationYaw);
|
||||
this.spectatedEntityID = e.getEntityId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpectatorData newInstance() {
|
||||
return new SpectatorData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Interpolation getCubicInterpolator() {
|
||||
return new AdvancedPositionSplineInterpolation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Interpolation getLinearInterpolator() {
|
||||
return new AdvancedPositionLinearInterpolation();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user