mirror of
https://github.com/GeyserExtensionists/GeyserModelEnginePackGenerator.git
synced 2025-12-20 07:29:29 +00:00
some improve
This commit is contained in:
@@ -25,11 +25,13 @@ public class ExtensionMain implements Extension {
|
|||||||
File[] files = source.listFiles();
|
File[] files = source.listFiles();
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
String id = "modelengine:" + file.getName();
|
String id = "modelengine:" + file.getName().toLowerCase();
|
||||||
GeyserUtils.addCustomEntity(id);
|
GeyserUtils.addCustomEntity(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPackLoad(GeyserLoadResourcePacksEvent event) {
|
public void onPackLoad(GeyserLoadResourcePacksEvent event) {
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class GeneratorMain {
|
|||||||
if (file1.listFiles() == null) {
|
if (file1.listFiles() == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String modelId = file1.getName();
|
String modelId = file1.getName().toLowerCase();
|
||||||
|
|
||||||
entityMap.put(modelId, new Entity(modelId));
|
entityMap.put(modelId, new Entity(modelId));
|
||||||
for (File e : file1.listFiles()) {
|
for (File e : file1.listFiles()) {
|
||||||
@@ -59,7 +59,6 @@ public class GeneratorMain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isGeometryFile(json)) {
|
if (isGeometryFile(json)) {
|
||||||
System.out.println("G");
|
|
||||||
Geometry geometry = new Geometry();
|
Geometry geometry = new Geometry();
|
||||||
geometry.load(json);
|
geometry.load(json);
|
||||||
geometry.setModelId(modelId);
|
geometry.setModelId(modelId);
|
||||||
|
|||||||
@@ -66,15 +66,16 @@ public class Animation {
|
|||||||
}
|
}
|
||||||
if (name.startsWith("h_") || name.startsWith("hi_")) {
|
if (name.startsWith("h_") || name.startsWith("hi_")) {
|
||||||
bones.add(name, new JsonParser().parse(HEAD_TEMPLATE));
|
bones.add(name, new JsonParser().parse(HEAD_TEMPLATE));
|
||||||
}
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GeneratorMain.entityMap
|
GeneratorMain.entityMap
|
||||||
.get(modelId).setHasHeadAnimation(true);
|
.get(modelId).setHasHeadAnimation(true);
|
||||||
|
|
||||||
object.add("bones", bones);
|
object.add("bones", bones);
|
||||||
json.get("animations").getAsJsonObject().add("animation." + modelId + ".look_at_target", object);
|
json.get("animations").getAsJsonObject().add("animation." + modelId + ".look_at_target", object);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,9 @@ public class Entity {
|
|||||||
"default": "%geometry%"
|
"default": "%geometry%"
|
||||||
},
|
},
|
||||||
"animations": {
|
"animations": {
|
||||||
"default": "animation.%geometry%.idle",
|
"default": "animation.%entity_id%.idle",
|
||||||
"look_at_target": "%look_at_target%"
|
"look_at_target": "%look_at_target%"
|
||||||
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"animate": [
|
"animate": [
|
||||||
|
|||||||
Reference in New Issue
Block a user