mirror of
https://github.com/xSquishyLiam/mc-GeyserModelEnginePackGenerator-extension.git
synced 2025-12-19 14:59:16 +00:00
fix override anim
This commit is contained in:
@@ -109,7 +109,7 @@ public class GeneratorMain {
|
||||
File texturesFolder = new File(output, "textures/entity");
|
||||
File animationControllersFolder = new File(output, "animation_controllers");
|
||||
File renderControllersFolder = new File(output, "render_controllers");
|
||||
|
||||
File materialsFolder = new File(output, "materials");
|
||||
|
||||
File manifestFile = new File(output, "manifest.json");
|
||||
|
||||
@@ -131,7 +131,10 @@ public class GeneratorMain {
|
||||
texturesFolder.mkdirs();
|
||||
animationControllersFolder.mkdirs();
|
||||
renderControllersFolder.mkdirs();
|
||||
materialsFolder.mkdirs();
|
||||
|
||||
File materialFile = new File(materialsFolder, "entity.material");
|
||||
|
||||
for (Map.Entry<String, Animation> entry : animationMap.entrySet()) {
|
||||
Geometry geo = geometryMap.get(entry.getKey());
|
||||
if (geo != null) {
|
||||
|
||||
@@ -46,6 +46,16 @@ public class Animation {
|
||||
for (Map.Entry<String, JsonElement> element : json.get("animations").getAsJsonObject().entrySet()) {
|
||||
animationIds.add(element.getKey());
|
||||
JsonObject animation = element.getValue().getAsJsonObject();
|
||||
|
||||
if (animation.has("override_previous_animation")) {
|
||||
if (animation.get("override_previous_animation").getAsBoolean()) {
|
||||
if (!animation.has("loop")) {
|
||||
animation.addProperty("loop", "hold_on_last_frame");
|
||||
// play once but override must use this to avoid strange anim
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (animation.has("loop")) {
|
||||
if (animation.get("loop").getAsJsonPrimitive().isString()) {
|
||||
if (animation.get("loop").getAsString().equals("hold_on_last_frame")) {
|
||||
@@ -74,6 +84,7 @@ public class Animation {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newAnimations.add("animation." + modelId + "." + element.getKey(), element.getValue());
|
||||
}
|
||||
json.add("animations", newAnimations);
|
||||
|
||||
@@ -23,8 +23,8 @@ public class PackManifest {
|
||||
}
|
||||
""";
|
||||
|
||||
public static String generate() {
|
||||
public static String generate() {
|
||||
return TEMPLATE.replace("%uuid-1%", UUID.randomUUID().toString())
|
||||
.replace("%uuid-2%", UUID.randomUUID().toString());
|
||||
.replace("%uuid-2%", UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user