Skip to content

Commit c3086e5

Browse files
committed
Remove defensive copy of model location collection in replaceAll
The defensive copy shouldn't be necessary, as the set is effectively immutable anyways
1 parent bb65831 commit c3086e5

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@
2020
import org.jetbrains.annotations.Nullable;
2121

2222
import java.util.AbstractSet;
23-
import java.util.ArrayList;
2423
import java.util.Collection;
2524
import java.util.Collections;
2625
import java.util.HashSet;
2726
import java.util.Iterator;
28-
import java.util.List;
2927
import java.util.Map;
3028
import java.util.Objects;
3129
import java.util.Optional;
@@ -233,8 +231,7 @@ public Set<Entry<ResourceLocation, BakedModel>> entrySet() {
233231
@Override
234232
public void replaceAll(BiFunction<? super ResourceLocation, ? super BakedModel, ? extends BakedModel> function) {
235233
ModernFix.LOGGER.warn("Mod '{}' is calling replaceAll on the model registry. Some hacks will be used to keep this fast, but they may not be 100% compatible.", modId);
236-
List<ResourceLocation> locations = new ArrayList<>(ourModelLocations);
237-
for(ResourceLocation location : locations) {
234+
for(ResourceLocation location : ourModelLocations) {
238235
/*
239236
* Fetching every model is insanely slow. So we call the function with a null object first, since it
240237
* probably isn't expecting that. If we get an exception thrown, or it returns nonnull, then we know

0 commit comments

Comments
 (0)