package client.renderer.blockmodel;

import java.util.Map;

import common.util.Facing;
import common.util.Vector3f;

public class BlockPart
{
    public final Vector3f positionFrom;
    public final Vector3f positionTo;
    public final Map<Facing, BlockPartFace> mapFaces;
    public BlockPartRotation partRotation;
    public boolean shade;

    public BlockPart(Vector3f positionFromIn, Vector3f positionToIn, Map<Facing, BlockPartFace> mapFacesIn, BlockPartRotation partRotationIn, boolean shadeIn)
    {
        this.positionFrom = positionFromIn;
        this.positionTo = positionToIn;
        this.mapFaces = mapFacesIn;
        this.partRotation = partRotationIn;
        this.shade = shadeIn;
    }

    public float[] getFaceUvs(Facing face)
    {
        float[] afloat;

        switch (face)
        {
            case DOWN:
            case UP:
                afloat = new float[] {this.positionFrom.x, this.positionFrom.z, this.positionTo.x, this.positionTo.z};
                break;
            case NORTH:
            case SOUTH:
                afloat = new float[] {this.positionFrom.x, 16.0F - this.positionTo.y, this.positionTo.x, 16.0F - this.positionFrom.y};
                break;
            case WEST:
            case EAST:
                afloat = new float[] {this.positionFrom.z, 16.0F - this.positionTo.y, this.positionTo.z, 16.0F - this.positionFrom.y};
                break;
            default:
                throw new NullPointerException();
        }

        return afloat;
    }
}
