Correctly parse Keyframe Presets with the new Spectator Keyframes from JSON

This commit is contained in:
CrushedPixel
2015-09-04 17:51:31 +02:00
parent 1b8c5dc47a
commit 1e0f5de800
2 changed files with 13 additions and 7 deletions

View File

@@ -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();