Skip to content

Commit 675c58a

Browse files
committed
Only call put on the model map if the replacement model is different
1 parent d1863cc commit 675c58a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

forge/src/main/java/org/embeddedt/modernfix/forge/dynresources/ModelBakeEventHelper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ public void replaceAll(BiFunction<? super ResourceLocation, ? super BakedModel,
156156
ModernFix.LOGGER.warn("Mod '{}' is calling replaceAll on the model registry. This requires temporarily loading every model for that mod, which is slow.", modId);
157157
List<ResourceLocation> locations = new ArrayList<>(keySet());
158158
for(ResourceLocation location : locations) {
159-
put(location, function.apply(location, get(location)));
159+
BakedModel existing = get(location);
160+
BakedModel replacement = function.apply(location, existing);
161+
if(replacement != existing) {
162+
put(location, replacement);
163+
}
160164
}
161165
}
162166
};

0 commit comments

Comments
 (0)