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:
CrushedPixel
2015-09-04 17:38:10 +02:00
parent e0785b4f25
commit 2f522c68fe
11 changed files with 97 additions and 46 deletions

View File

@@ -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