mirror of
https://github.com/GeyserExtensionists/GeyserModelEnginePackGenerator.git
synced 2025-12-19 23:19:20 +00:00
new things
This commit is contained in:
@@ -45,6 +45,32 @@ public class Animation {
|
|||||||
JsonObject newAnimations = new JsonObject();
|
JsonObject newAnimations = new JsonObject();
|
||||||
for (Map.Entry<String, JsonElement> element : json.get("animations").getAsJsonObject().entrySet()) {
|
for (Map.Entry<String, JsonElement> element : json.get("animations").getAsJsonObject().entrySet()) {
|
||||||
animationIds.add(element.getKey());
|
animationIds.add(element.getKey());
|
||||||
|
JsonObject animation = element.getValue().getAsJsonObject();
|
||||||
|
if (animation.has("loop")) {
|
||||||
|
if (animation.get("loop").getAsJsonPrimitive().isString()) {
|
||||||
|
if (animation.get("loop").getAsString().equals("hold_on_last_frame")) {
|
||||||
|
for (Map.Entry<String, JsonElement> bone : animation.get("bones").getAsJsonObject().entrySet()) {
|
||||||
|
|
||||||
|
for (Map.Entry<String, JsonElement> anim : bone.getValue().getAsJsonObject().entrySet()) {
|
||||||
|
float max = -1;
|
||||||
|
JsonObject end = null;
|
||||||
|
for (Map.Entry<String, JsonElement> timeline : anim.getValue().getAsJsonObject().entrySet()) {
|
||||||
|
float time = Float.parseFloat(timeline.getKey());
|
||||||
|
if (time > max) {
|
||||||
|
max = time;
|
||||||
|
if (timeline.getValue().isJsonObject()) {
|
||||||
|
end = timeline.getValue().getAsJsonObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (end != null && end.get("lerp_mode").getAsString().equals("catmullrom")) {
|
||||||
|
end.addProperty("lerp_mode", "linear");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
newAnimations.add("animation." + modelId + "." + element.getKey(), element.getValue());
|
newAnimations.add("animation." + modelId + "." + element.getKey(), element.getValue());
|
||||||
}
|
}
|
||||||
json.add("animations", newAnimations);
|
json.add("animations", newAnimations);
|
||||||
|
|||||||
Reference in New Issue
Block a user