Skip to content

Commit

Permalink
Fix Debark crash
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt committed Aug 26, 2023
1 parent 55c2b5b commit 2c82194
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ public IModel getObject(ResourceLocation location) {
return opt.orElse(null);
}

public IModel getModelOrMissing(ResourceLocation location) {
try {
return getObject(location);
} catch(RuntimeException e) {
return getObject(new ModelResourceLocation("builtin/missing", "missing"));
}
}

private static final Map<ResourceLocation, IModel> MODEL_LOADER_REGISTRY_CACHE = ObfuscationReflectionHelper.getPrivateValue(ModelLoaderRegistry.class, null, "cache");

private static final Class<?> VANILLA_MODEL_WRAPPER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class MixinModelLoaderEarlyViewDebark {

@Inject(method = "<init>", at = @At("RETURN") , remap = false)
private void changeBackingMap(CallbackInfo ci) {
this.secretSauce = Maps.asMap(ModelLocationInformation.allKnownModelLocations, location -> DynamicModelProvider.instance.getObject(location));
this.secretSauce = Maps.asMap(ModelLocationInformation.allKnownModelLocations, location -> DynamicModelProvider.instance.getModelOrMissing(location));
}

}

0 comments on commit 2c82194

Please sign in to comment.