Only call put on the model map if the replacement model is different

This commit is contained in:
embeddedt 2023-12-27 16:13:45 -05:00
parent d1863cc66e
commit 675c58a437
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -156,7 +156,11 @@ public class ModelBakeEventHelper {
ModernFix.LOGGER.warn("Mod '{}' is calling replaceAll on the model registry. This requires temporarily loading every model for that mod, which is slow.", modId);
List<ResourceLocation> locations = new ArrayList<>(keySet());
for(ResourceLocation location : locations) {
put(location, function.apply(location, get(location)));
BakedModel existing = get(location);
BakedModel replacement = function.apply(location, existing);
if(replacement != existing) {
put(location, replacement);
}
}
}
};