Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.collect.ForwardingMap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.common.graph.GraphBuilder;
import com.google.common.graph.MutableGraph;
Expand Down Expand Up @@ -64,7 +65,7 @@ public ModelBakeEventHelper(Map<ResourceLocation, BakedModel> modelRegistry) {
for (var b : BuiltInRegistries.BLOCK) {
blockStateCount += b.getStateDefinition().getPossibleStates().size();
}
this.topLevelModelLocations = new ObjectLinkedOpenHashSet<>(blockStateCount + BuiltInRegistries.ITEM.size());
Set<ResourceLocation> topLevelModelLocations = new ObjectLinkedOpenHashSet<>(blockStateCount + BuiltInRegistries.ITEM.size());
this.namespacesWithModels = new ObjectOpenHashSet<>(ModList.get().size());
var modelLocationBuilder = new ModelLocationBuilder();
BuiltInRegistries.BLOCK.entrySet().forEach(entry -> {
Expand All @@ -76,10 +77,13 @@ public ModelBakeEventHelper(Map<ResourceLocation, BakedModel> modelRegistry) {
topLevelModelLocations.add(new ModelResourceLocation(key, "inventory"));
namespacesWithModels.add(key.getNamespace());
});
this.topLevelModelLocations.addAll(modelRegistry.keySet());
topLevelModelLocations.addAll(modelRegistry.keySet());
for (var loc : modelRegistry.keySet()) {
this.namespacesWithModels.add(loc.getNamespace());
}
// Iteration uses a compact array instead of following links through the hash table.
// These locations are only exposed through read-only views after construction.
this.topLevelModelLocations = ImmutableSet.copyOf(topLevelModelLocations);
this.dependencyGraph = buildDependencyGraph();
}

Expand Down
Loading