some improve

This commit is contained in:
zimzaza4
2024-04-21 14:00:30 +08:00
parent a20c2eb421
commit a768a4cc64
4 changed files with 8 additions and 5 deletions

View File

@@ -25,11 +25,13 @@ public class ExtensionMain implements Extension {
File[] files = source.listFiles();
if (files != null) {
for (File file : files) {
String id = "modelengine:" + file.getName();
String id = "modelengine:" + file.getName().toLowerCase();
GeyserUtils.addCustomEntity(id);
}
}
}
@Subscribe
public void onPackLoad(GeyserLoadResourcePacksEvent event) {

View File

@@ -40,7 +40,7 @@ public class GeneratorMain {
if (file1.listFiles() == null) {
continue;
}
String modelId = file1.getName();
String modelId = file1.getName().toLowerCase();
entityMap.put(modelId, new Entity(modelId));
for (File e : file1.listFiles()) {
@@ -59,7 +59,6 @@ public class GeneratorMain {
}
if (isGeometryFile(json)) {
System.out.println("G");
Geometry geometry = new Geometry();
geometry.load(json);
geometry.setModelId(modelId);

View File

@@ -66,15 +66,16 @@ public class Animation {
}
if (name.startsWith("h_") || name.startsWith("hi_")) {
bones.add(name, new JsonParser().parse(HEAD_TEMPLATE));
}
i++;
}
}
}
if (i == 0) {
return;
}
GeneratorMain.entityMap
.get(modelId).setHasHeadAnimation(true);
object.add("bones", bones);
json.get("animations").getAsJsonObject().add("animation." + modelId + ".look_at_target", object);
}

View File

@@ -26,8 +26,9 @@ public class Entity {
"default": "%geometry%"
},
"animations": {
"default": "animation.%geometry%.idle",
"default": "animation.%entity_id%.idle",
"look_at_target": "%look_at_target%"
},
"scripts": {
"animate": [