1010import net .minecraft .client .resources .model .ModelBakery ;
1111import net .minecraft .client .resources .model .ModelResourceLocation ;
1212import net .minecraft .resources .ResourceLocation ;
13- import net .minecraft .world .level .block .Block ;
1413import net .minecraft .world .level .block .state .BlockState ;
1514import net .minecraftforge .fml .ModContainer ;
1615import net .minecraftforge .fml .ModList ;
2019import org .embeddedt .modernfix .util .ForwardingInclDefaultsMap ;
2120import org .jetbrains .annotations .Nullable ;
2221
23- import java .util .*;
22+ import java .util .ArrayList ;
23+ import java .util .Collection ;
24+ import java .util .HashSet ;
25+ import java .util .List ;
26+ import java .util .Map ;
27+ import java .util .Objects ;
28+ import java .util .Optional ;
29+ import java .util .Set ;
2430import java .util .function .BiFunction ;
2531
2632/**
@@ -41,12 +47,12 @@ public ModelBakeEventHelper(Map<ResourceLocation, BakedModel> modelRegistry) {
4147 this .modelRegistry = modelRegistry ;
4248 this .topLevelModelLocations = new HashSet <>(modelRegistry .keySet ());
4349 // Skip going through ModelLocationCache because most of the accesses will be misses
44- for ( Block block : ForgeRegistries .BLOCKS ) {
45- ResourceLocation name = block . delegate . name ();
46- for (BlockState state : block .getStateDefinition ().getPossibleStates ()) {
47- topLevelModelLocations .add (BlockModelShaper .stateToModelLocation (name , state ));
50+ ForgeRegistries .BLOCKS . getEntries (). forEach ( entry -> {
51+ var location = entry . getKey (). location ();
52+ for (BlockState state : entry . getValue () .getStateDefinition ().getPossibleStates ()) {
53+ topLevelModelLocations .add (BlockModelShaper .stateToModelLocation (location , state ));
4854 }
49- }
55+ });
5056 ForgeRegistries .ITEMS .getKeys ().forEach (key -> topLevelModelLocations .add (new ModelResourceLocation (key , "inventory" )));
5157 this .dependencyGraph = GraphBuilder .undirected ().build ();
5258 ModList .get ().forEachModContainer ((id , mc ) -> {
0 commit comments