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/**
@@ -42,12 +48,12 @@ public ModelBakeEventHelper(Map<ResourceLocation, BakedModel> modelRegistry) {
4248 this .modelRegistry = modelRegistry ;
4349 this .topLevelModelLocations = new HashSet <>(modelRegistry .keySet ());
4450 // Skip going through ModelLocationCache because most of the accesses will be misses
45- for ( Block block : ForgeRegistries .BLOCKS ) {
46- ResourceLocation name = block . delegate . name ();
47- for (BlockState state : block .getStateDefinition ().getPossibleStates ()) {
48- topLevelModelLocations .add (BlockModelShaper .stateToModelLocation (name , state ));
51+ ForgeRegistries .BLOCKS . getEntries (). forEach ( entry -> {
52+ var location = entry . getKey (). location ();
53+ for (BlockState state : entry . getValue () .getStateDefinition ().getPossibleStates ()) {
54+ topLevelModelLocations .add (BlockModelShaper .stateToModelLocation (location , state ));
4955 }
50- }
56+ });
5157 ForgeRegistries .ITEMS .getKeys ().forEach (key -> topLevelModelLocations .add (new ModelResourceLocation (key , "inventory" )));
5258 this .dependencyGraph = GraphBuilder .undirected ().build ();
5359 ModList .get ().forEachModContainer ((id , mc ) -> {
0 commit comments