Skip to content

Commit dfdbf85

Browse files
committed
Guard against early parent resolution failing
1 parent 49b31c3 commit dfdbf85

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/perf/dynamic_resources/ModelBakeryMixin.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,10 @@ public void getOrLoadModelDynamic(ResourceLocation modelLocation, CallbackInfoRe
401401
// As in pathological cases (e.g. Pedestals on 1.19) unbakedCache can lose
402402
// the model immediately
403403
UnbakedModel result = smallLoadingCache.getOrDefault(modelLocation, iunbakedmodel);
404-
// required as some mods (e.g. EBE) call bake directly on the returned model, without resolving parents themselves
405-
result.getMaterials(this::getModel, new HashSet<>());
404+
try {
405+
// required as some mods (e.g. EBE) call bake directly on the returned model, without resolving parents themselves
406+
result.getMaterials(this::getModel, new HashSet<>());
407+
} catch(RuntimeException ignored) {}
406408
// We are done with loading, so clear this cache to allow GC of any unneeded models
407409
if(mfix$nestedLoads == 0)
408410
smallLoadingCache.clear();

forge/src/main/java/org/embeddedt/modernfix/forge/mixin/perf/dynamic_resources/ModelBakeryMixin.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,10 @@ public void getOrLoadModelDynamic(ResourceLocation modelLocation, CallbackInfoRe
286286
// As in pathological cases (e.g. Pedestals on 1.19) unbakedCache can lose
287287
// the model immediately
288288
UnbakedModel result = smallLoadingCache.getOrDefault(modelLocation, iunbakedmodel);
289-
// required as some mods (e.g. EBE) call bake directly on the returned model, without resolving parents themselves
290-
result.getMaterials(this::getModel, new HashSet<>());
289+
try {
290+
// required as some mods (e.g. EBE) call bake directly on the returned model, without resolving parents themselves
291+
result.getMaterials(this::getModel, new HashSet<>());
292+
} catch(RuntimeException ignored) {}
291293
// We are done with loading, so clear this cache to allow GC of any unneeded models
292294
if(mfix$nestedLoads == 0)
293295
smallLoadingCache.clear();

0 commit comments

Comments
 (0)