11package org .embeddedt .modernfix .forge .dynresources ;
22
33import com .google .common .collect .ForwardingMap ;
4+ import com .google .common .collect .ImmutableSet ;
45import com .google .common .collect .Sets ;
56import com .google .common .graph .GraphBuilder ;
67import com .google .common .graph .MutableGraph ;
2627 * of the model registry that emulates vanilla keySet behavior.
2728 */
2829public class ModelBakeEventHelper {
30+ // TODO: make into config option
31+ private static final Set <String > INCOMPATIBLE_MODS = ImmutableSet .of ("industrialforegoing" );
2932 private final Map <ResourceLocation , BakedModel > modelRegistry ;
3033 private final Set <ResourceLocation > topLevelModelLocations ;
3134 private final MutableGraph <String > dependencyGraph ;
@@ -43,6 +46,9 @@ public ModelBakeEventHelper(Map<ResourceLocation, BakedModel> modelRegistry) {
4346 this .dependencyGraph = GraphBuilder .undirected ().build ();
4447 ModList .get ().forEachModContainer ((id , mc ) -> {
4548 this .dependencyGraph .addNode (id );
49+ for (IModInfo .ModVersion version : mc .getModInfo ().getDependencies ()) {
50+ this .dependencyGraph .addNode (version .getModId ());
51+ }
4652 });
4753 for (String id : this .dependencyGraph .nodes ()) {
4854 Optional <? extends ModContainer > mContainer = ModList .get ().getModContainerById (id );
@@ -61,6 +67,8 @@ public Map<ResourceLocation, BakedModel> wrapRegistry(String modId) {
6167 modIdsToInclude .addAll (this .dependencyGraph .adjacentNodes (modId ));
6268 } catch (IllegalArgumentException ignored ) { /* sanity check */ }
6369 modIdsToInclude .remove ("minecraft" );
70+ if (modIdsToInclude .stream ().noneMatch (INCOMPATIBLE_MODS ::contains ))
71+ return this .modelRegistry ;
6472 Set <ResourceLocation > ourModelLocations = Sets .filter (this .topLevelModelLocations , loc -> modIdsToInclude .contains (loc .getNamespace ()));
6573 return new ForwardingMap <ResourceLocation , BakedModel >() {
6674 @ Override
0 commit comments