Skip to content

Commit

Permalink
fix: Try to fix the anim model problem(3).
Browse files Browse the repository at this point in the history
  • Loading branch information
MegumiKasuga committed Dec 2, 2024
1 parent 0a42349 commit 2906019
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"loader": "kasuga_lib:bedrock_model",
"loader": "kasuga_lib:bedrock_animated",
"model": "kasuga_lib:block/test/test_model_complicate",
"texture": "kasuga_lib:common/test/test_model_complicate",
"render_type": "translucent",
"geometry": "geometry.unknown",
"identifier": "kasuga_lib:test_model_complicate"
}
13 changes: 9 additions & 4 deletions src/main/java/kasuga/lib/core/client/model/AnimModelLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,17 @@ public AnimModel read(JsonObject jsonObject, JsonDeserializationContext deserial
}
}
if (geo == null) return null;
ResourceLocation identifier = new ResourceLocation(jsonObject.get("identifier").getAsString());
AnimModel animModel = new AnimModel(geo, model.getMaterials(), renderTypeHint);
if (MODELS.containsKey(identifier)) {
KasugaLib.MAIN_LOGGER.warn("Anim Model: " + identifier + " already exists, COVERED!");
if (jsonObject.has("identifier")) {
ResourceLocation identifier = new ResourceLocation(jsonObject.get("identifier").getAsString());
if (MODELS.containsKey(identifier)) {
KasugaLib.MAIN_LOGGER.warn("Anim Model: " + identifier + " already exists, COVERED!");
}
MODELS.put(identifier, animModel);
} else {
KasugaLib.MAIN_LOGGER.warn("Anim Model: " + model.modelLocation + " has no identifier, " +
"and it WOULD NOT BE ABLE TO USE IN RENDERERS!");
}
MODELS.put(identifier, animModel);
return animModel;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ public static BedrockModel readModel(JsonObject jsonObject, @Nullable JsonDeseri
BedrockModel model = new BedrockModel(
new ResourceLocation(ml.getNamespace(), "models/" + ml.getPath() + ".geo.json"),
flipV, texture, materials);
ResourceLocation identifier = new ResourceLocation(jsonObject.get("identifier").getAsString());
MODELS.put(identifier, model);
if (jsonObject.has("identifier")) {
ResourceLocation identifier = new ResourceLocation(jsonObject.get("identifier").getAsString());
MODELS.put(identifier, model);
}
return model;
}

Expand Down

0 comments on commit 2906019

Please sign in to comment.