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() {
|
public void register(String namespace) {
|
||||||
String id = "modelengine:" + modelId;
|
String id = namespace + ":" + modelId;
|
||||||
|
|
||||||
boolean registered = REGISTERED_ENTITIES.contains(id);
|
boolean registered = REGISTERED_ENTITIES.contains(id);
|
||||||
if (registered) return;
|
if (registered) return;
|
||||||
|
|
||||||
@@ -121,13 +122,13 @@ public class Entity {
|
|||||||
|
|
||||||
if (!modelConfig.isDisablePartVisibility()) {
|
if (!modelConfig.isDisablePartVisibility()) {
|
||||||
for (int i = 0; i < Math.ceil(geometry.getBones().size() / 24f); i++) {
|
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) {
|
if (animation != null) {
|
||||||
for (int i = 0; i < Math.ceil(animation.getAnimationIds().size() / 24f); i++) {
|
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,
|
"format_version": 1,
|
||||||
"header": {
|
"header": {
|
||||||
"name": "ModelEngine",
|
"name": "GeyserModelEngine",
|
||||||
"description": "ModelEngine For Geyser",
|
"description": "GeyserModelEngine For Geyser",
|
||||||
"uuid": "%uuid-1%",
|
"uuid": "%uuid-1%",
|
||||||
"version": [0, 0, 1]
|
"version": [0, 0, 1]
|
||||||
},
|
},
|
||||||
"modules": [
|
"modules": [
|
||||||
{
|
{
|
||||||
"type": "resources",
|
"type": "resources",
|
||||||
"description": "ModelEngine",
|
"description": "GeyserModelEngine",
|
||||||
"uuid": "%uuid-2%",
|
"uuid": "%uuid-2%",
|
||||||
"version": [0, 0, 1]
|
"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
|
// 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());
|
List<String> se = new ArrayList<>(bones.keySet());
|
||||||
Collections.sort(se);
|
Collections.sort(se);
|
||||||
JsonObject root = new JsonObject();
|
JsonObject root = new JsonObject();
|
||||||
@@ -155,7 +155,7 @@ public class RenderController {
|
|||||||
if (entity.getModelConfig().isDisablePartVisibility()) {
|
if (entity.getModelConfig().isDisablePartVisibility()) {
|
||||||
visibilityItem.addProperty(boneName, true);
|
visibilityItem.addProperty(boneName, true);
|
||||||
} else {
|
} 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);
|
partVisibility.add(visibilityItem);
|
||||||
if (!uvBonesId.contains("*")) {
|
if (!uvBonesId.contains("*")) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class ResourcePackManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Entity entity : entityCache.values()) {
|
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;
|
if (renderPath.toFile().exists()) continue;
|
||||||
|
|
||||||
try {
|
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) {
|
} catch (IOException err) {
|
||||||
throw new RuntimeException(err);
|
throw new RuntimeException(err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
models:
|
||||||
|
namespace: "modelengine"
|
||||||
|
|
||||||
options:
|
options:
|
||||||
resource-pack:
|
resource-pack:
|
||||||
|
|||||||
Reference in New Issue
Block a user