package net.minecraft.core;

import java.util.AbstractList;
import net.minecraft.nbt.FloatTag;
import net.minecraft.nbt.ListTag;

public class Rotations {
    protected final float x;
    protected final float y;
    protected final float z;
    
    public Rotations(final float float1, final float float2, final float float3) {
        this.x = ((Float.isInfinite(float1) || Float.isNaN(float1)) ? 0.0f : (float1 % 360.0f));
        this.y = ((Float.isInfinite(float2) || Float.isNaN(float2)) ? 0.0f : (float2 % 360.0f));
        this.z = ((Float.isInfinite(float3) || Float.isNaN(float3)) ? 0.0f : (float3 % 360.0f));
    }
    
    public Rotations(final ListTag jz) {
        this(jz.getFloat(0), jz.getFloat(1), jz.getFloat(2));
    }
    
    public ListTag save() {
        final ListTag jz2 = new ListTag();
        ((AbstractList<FloatTag>)jz2).add(FloatTag.valueOf(this.x));
        ((AbstractList<FloatTag>)jz2).add(FloatTag.valueOf(this.y));
        ((AbstractList<FloatTag>)jz2).add(FloatTag.valueOf(this.z));
        return jz2;
    }
    
    @Override
    public boolean equals(final Object object) {
        if (!(object instanceof Rotations)) {
            return false;
        }
        final Rotations gc3 = (Rotations)object;
        return this.x == gc3.x && this.y == gc3.y && this.z == gc3.z;
    }
    
    public float getX() {
        return this.x;
    }
    
    public float getY() {
        return this.y;
    }
    
    public float getZ() {
        return this.z;
    }
}
