Correctly parse Keyframe Presets with the new Spectator Keyframes from JSON
This commit is contained in:
@@ -14,7 +14,7 @@ import net.minecraft.entity.Entity;
|
||||
@EqualsAndHashCode(callSuper=true)
|
||||
public class SpectatorData extends AdvancedPosition {
|
||||
|
||||
private int spectatedEntityID;
|
||||
private Integer spectatedEntityID;
|
||||
|
||||
public SpectatorData(double x, double y, double z, double pitch, double yaw, double roll, int entityID) {
|
||||
super(x, y, z, pitch, yaw, roll);
|
||||
@@ -30,6 +30,15 @@ public class SpectatorData extends AdvancedPosition {
|
||||
this.spectatedEntityID = e.getEntityId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return itself if it's a valid SpectatorData object,
|
||||
* otherwise a new AdvancedPosition object containing the same position data
|
||||
*/
|
||||
public AdvancedPosition normalize() {
|
||||
if(spectatedEntityID != null) return this;
|
||||
return new AdvancedPosition(x, y, z, pitch, yaw, roll);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpectatorData newInstance() {
|
||||
return new SpectatorData();
|
||||
|
||||
Reference in New Issue
Block a user