This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
Gestus/src/main/java/com/thebrokenrail/gestus/emote/EmoteFrame.java

26 lines
842 B
Java
Raw Normal View History

2020-08-11 21:00:26 +00:00
package com.thebrokenrail.gestus.emote;
import net.minecraft.util.math.EulerAngle;
import java.util.HashMap;
import java.util.Map;
public class EmoteFrame {
2020-08-15 03:31:51 +00:00
public final Map<EmotePart, EulerAngle> normal;
public final Map<EmotePart, EulerAngle> mirrored;
2020-08-11 21:00:26 +00:00
public EmoteFrame(Map<EmotePart, EulerAngle> data) {
2020-08-15 03:31:51 +00:00
normal = data;
mirrored = mirror(data);
2020-08-11 21:00:26 +00:00
}
2020-08-15 03:31:51 +00:00
private static Map<EmotePart, EulerAngle> mirror(Map<EmotePart, EulerAngle> data) {
2020-08-11 21:00:26 +00:00
Map<EmotePart, EulerAngle> result = new HashMap<>();
for (Map.Entry<EmotePart, EulerAngle> entry : data.entrySet()) {
2020-08-15 03:31:51 +00:00
EmotePart newPart = entry.getKey().mirror();
result.put(newPart, new EulerAngle(entry.getValue().getPitch(), -entry.getValue().getYaw(), -entry.getValue().getRoll()));
2020-08-11 21:00:26 +00:00
}
return result;
}
}