@@ -93,6 +93,14 @@ public FabricMod(ModContainer modContainer, Set<String> modpackMods) {
9393 links .putAll (CustomValueUtil .getStringMap ("links" , modMenuObject ).orElse (new HashMap <>()));
9494 allowsUpdateChecks = CustomValueUtil .getBoolean ("update_checker" , modMenuObject ).orElse (true );
9595 }
96+
97+ boolean isGenerated = CustomValueUtil .getBoolean ("fabric-loom:generated" , metadata ).orElse (false );
98+
99+ /* Automatically set the mod containing a Loom-generated library as its parent */
100+ if (isGenerated && parentId .isEmpty () && container .getContainingMod ().isPresent ()) {
101+ ModContainer inside = container .getContainingMod ().get ();
102+ parentId = Optional .of (inside .getMetadata ().getId ());
103+ }
96104 this .modMenuData = new ModMenuData (badgeNames , parentId , parentData , id );
97105
98106 /* Hardcode parents and badges for Fabric API & Fabric Loader */
@@ -117,10 +125,7 @@ public FabricMod(ModContainer modContainer, Set<String> modpackMods) {
117125 if (this .metadata .getEnvironment () == ModEnvironment .CLIENT ) {
118126 badges .add (Badge .CLIENT );
119127 }
120- if (OptionalUtil .isPresentAndTrue (CustomValueUtil .getBoolean (
121- "fabric-loom:generated" ,
122- metadata
123- )) || "java" .equals (id )) {
128+ if (isGenerated || "java" .equals (id )) {
124129 badges .add (Badge .LIBRARY );
125130 }
126131 if ("deprecated" .equals (CustomValueUtil .getString ("fabric-api:module-lifecycle" , metadata ).orElse (null ))) {
0 commit comments