Make replaceAll implementation more robust, add warning

This commit is contained in:
embeddedt 2023-12-27 16:06:22 -05:00
parent 11508fbe07
commit d1863cc66e
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -153,7 +153,9 @@ public class ModelBakeEventHelper {
@Override
public void replaceAll(BiFunction<? super ResourceLocation, ? super BakedModel, ? extends BakedModel> function) {
for(ResourceLocation location : keySet()) {
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)));
}
}