mirror of
https://github.com/xSquishyLiam/mc-GeyserModelEnginePackGenerator-extension.git
synced 2025-12-19 23:09: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 texturesFolder = new File(output, "textures/entity");
|
||||||
File animationControllersFolder = new File(output, "animation_controllers");
|
File animationControllersFolder = new File(output, "animation_controllers");
|
||||||
File renderControllersFolder = new File(output, "render_controllers");
|
File renderControllersFolder = new File(output, "render_controllers");
|
||||||
|
File materialsFolder = new File(output, "materials");
|
||||||
|
|
||||||
File manifestFile = new File(output, "manifest.json");
|
File manifestFile = new File(output, "manifest.json");
|
||||||
|
|
||||||
@@ -131,6 +131,9 @@ public class GeneratorMain {
|
|||||||
texturesFolder.mkdirs();
|
texturesFolder.mkdirs();
|
||||||
animationControllersFolder.mkdirs();
|
animationControllersFolder.mkdirs();
|
||||||
renderControllersFolder.mkdirs();
|
renderControllersFolder.mkdirs();
|
||||||
|
materialsFolder.mkdirs();
|
||||||
|
|
||||||
|
File materialFile = new File(materialsFolder, "entity.material");
|
||||||
|
|
||||||
for (Map.Entry<String, Animation> entry : animationMap.entrySet()) {
|
for (Map.Entry<String, Animation> entry : animationMap.entrySet()) {
|
||||||
Geometry geo = geometryMap.get(entry.getKey());
|
Geometry geo = geometryMap.get(entry.getKey());
|
||||||
|
|||||||
@@ -46,6 +46,16 @@ public class Animation {
|
|||||||
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();
|
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.has("loop")) {
|
||||||
if (animation.get("loop").getAsJsonPrimitive().isString()) {
|
if (animation.get("loop").getAsJsonPrimitive().isString()) {
|
||||||
if (animation.get("loop").getAsString().equals("hold_on_last_frame")) {
|
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());
|
newAnimations.add("animation." + modelId + "." + element.getKey(), element.getValue());
|
||||||
}
|
}
|
||||||
json.add("animations", newAnimations);
|
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())
|
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