mirror of
https://github.com/xSquishyLiam/mc-GeyserModelEnginePackGenerator-extension.git
synced 2025-12-19 14:59:16 +00:00
added namespace support make sure to add inside the config models.namespace
This commit is contained in:
@@ -110,8 +110,9 @@ public class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public void register() {
|
||||
String id = "modelengine:" + modelId;
|
||||
public void register(String namespace) {
|
||||
String id = namespace + ":" + modelId;
|
||||
|
||||
boolean registered = REGISTERED_ENTITIES.contains(id);
|
||||
if (registered) return;
|
||||
|
||||
@@ -121,13 +122,13 @@ public class Entity {
|
||||
|
||||
if (!modelConfig.isDisablePartVisibility()) {
|
||||
for (int i = 0; i < Math.ceil(geometry.getBones().size() / 24f); i++) {
|
||||
GeyserUtils.addProperty(id, "modelengine:bone" + i, Integer.class);
|
||||
GeyserUtils.addProperty(id, namespace + ":" + "bone" + i, Integer.class);
|
||||
}
|
||||
}
|
||||
|
||||
if (animation != null) {
|
||||
for (int i = 0; i < Math.ceil(animation.getAnimationIds().size() / 24f); i++) {
|
||||
GeyserUtils.addProperty(id, "modelengine:anim" + i, Integer.class);
|
||||
GeyserUtils.addProperty(id, namespace + ":" + "anim" + i, Integer.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,15 +8,15 @@ public class PackManifest {
|
||||
{
|
||||
"format_version": 1,
|
||||
"header": {
|
||||
"name": "ModelEngine",
|
||||
"description": "ModelEngine For Geyser",
|
||||
"name": "GeyserModelEngine",
|
||||
"description": "GeyserModelEngine For Geyser",
|
||||
"uuid": "%uuid-1%",
|
||||
"version": [0, 0, 1]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"type": "resources",
|
||||
"description": "ModelEngine",
|
||||
"description": "GeyserModelEngine",
|
||||
"uuid": "%uuid-2%",
|
||||
"version": [0, 0, 1]
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class RenderController {
|
||||
}
|
||||
|
||||
// look, I'm fine with your other code and stuff, but I ain't using templates for JSON lmao
|
||||
public String generate() {
|
||||
public String generate(String namespace) {
|
||||
List<String> se = new ArrayList<>(bones.keySet());
|
||||
Collections.sort(se);
|
||||
JsonObject root = new JsonObject();
|
||||
@@ -155,7 +155,7 @@ public class RenderController {
|
||||
if (entity.getModelConfig().isDisablePartVisibility()) {
|
||||
visibilityItem.addProperty(boneName, true);
|
||||
} else {
|
||||
visibilityItem.addProperty(boneName, "math.mod(math.floor(query.property('modelengine:bone" + index / 24 + "') / " + n + "), 2) == 1");
|
||||
visibilityItem.addProperty(boneName, "math.mod(math.floor(query.property('" + namespace + ":bone" + index / 24 + "') / " + n + "), 2) == 1");
|
||||
}
|
||||
partVisibility.add(visibilityItem);
|
||||
if (!uvBonesId.contains("*")) {
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ResourcePackManager {
|
||||
}
|
||||
|
||||
for (Entity entity : entityCache.values()) {
|
||||
entity.register();
|
||||
entity.register(extension.getConfigManager().getConfig().getString("models.namespace"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class ResourcePackManager {
|
||||
if (renderPath.toFile().exists()) continue;
|
||||
|
||||
try {
|
||||
Files.writeString(renderPath, controller.generate(), StandardCharsets.UTF_8);
|
||||
Files.writeString(renderPath, controller.generate(extension.getConfigManager().getConfig().getString("models.namespace")), StandardCharsets.UTF_8);
|
||||
} catch (IOException err) {
|
||||
throw new RuntimeException(err);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
models:
|
||||
namespace: "modelengine"
|
||||
|
||||
options:
|
||||
resource-pack:
|
||||
|
||||
Reference in New Issue
Block a user