Fetch a model the vanilla way if it fails to be present in

the lookup cache when gathering textures
This commit is contained in:
embeddedt 2023-04-11 21:31:55 -04:00
parent 87f74bc1b9
commit d709335ac2
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -298,10 +298,17 @@ public abstract class ModelBakeryMixin {
}
}
modelFiles = null;
Function<ResourceLocation, UnbakedModel> modelGetter = loc -> basicModels.getOrDefault(loc, (BlockModel)this.missingModel);
Function<ResourceLocation, UnbakedModel> modelGetter = loc -> {
UnbakedModel m = basicModels.get(loc);
/* fallback to vanilla loader if missing */
return m != null ? m : this.getModel(loc);
};
for(BlockModel model : basicModels.values()) {
materialSet.addAll(model.getMaterials(modelGetter, errorSet));
}
/* discard whatever garbage was just produced */
loadedModels.invalidateAll();
loadedModels.put(MISSING_MODEL_LOCATION, missingModel);
//errorSet.stream().filter(pair -> !pair.getSecond().equals(MISSING_MODEL_LOCATION_STRING)).forEach(pair -> LOGGER.warn("Unable to resolve texture reference: {} in {}", pair.getFirst(), pair.getSecond()));
stopwatch.stop();
ModernFix.LOGGER.info("Resolving model textures took " + stopwatch);