Remove defensive copy of model location collection in replaceAll
The defensive copy shouldn't be necessary, as the set is effectively immutable anyways
This commit is contained in:
parent
bb658319cb
commit
c3086e5249
|
|
@ -20,12 +20,10 @@ import org.embeddedt.modernfix.util.ForwardingInclDefaultsMap;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.AbstractSet;
|
import java.util.AbstractSet;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
@ -233,8 +231,7 @@ public class ModelBakeEventHelper {
|
||||||
@Override
|
@Override
|
||||||
public void replaceAll(BiFunction<? super ResourceLocation, ? super BakedModel, ? extends BakedModel> function) {
|
public void replaceAll(BiFunction<? super ResourceLocation, ? super BakedModel, ? extends BakedModel> function) {
|
||||||
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);
|
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);
|
||||||
List<ResourceLocation> locations = new ArrayList<>(ourModelLocations);
|
for(ResourceLocation location : ourModelLocations) {
|
||||||
for(ResourceLocation location : locations) {
|
|
||||||
/*
|
/*
|
||||||
* Fetching every model is insanely slow. So we call the function with a null object first, since it
|
* Fetching every model is insanely slow. So we call the function with a null object first, since it
|
||||||
* probably isn't expecting that. If we get an exception thrown, or it returns nonnull, then we know
|
* probably isn't expecting that. If we get an exception thrown, or it returns nonnull, then we know
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user