package com.thebrokenrail.gestus.emote;

import net.minecraft.util.math.EulerAngle;

import java.util.HashMap;
import java.util.Map;

public class EmoteFrame {
    public final Map<EmotePart, EulerAngle> normal;
    public final Map<EmotePart, EulerAngle> mirrored;

    public EmoteFrame(Map<EmotePart, EulerAngle> data) {
        normal = data;
        mirrored = mirror(data);
    }

    private static Map<EmotePart, EulerAngle> mirror(Map<EmotePart, EulerAngle> data) {
        Map<EmotePart, EulerAngle> result = new HashMap<>();
        for (Map.Entry<EmotePart, EulerAngle> entry : data.entrySet()) {
            EmotePart newPart = entry.getKey().mirror();
            result.put(newPart, new EulerAngle(entry.getValue().getPitch(), -entry.getValue().getYaw(), -entry.getValue().getRoll()));
        }
        return result;
    }
}
