1515import net .minecraft .util .ResourceLocation ;
1616import net .minecraftforge .fml .common .Loader ;
1717import net .minecraftforge .fml .common .ModMetadata ;
18+ import org .apache .commons .lang3 .StringUtils ;
1819import org .apache .commons .lang3 .tuple .Pair ;
1920import org .jetbrains .annotations .ApiStatus ;
2021
@@ -29,6 +30,7 @@ public static JsonObject createDefaultJson() {
2930 JsonObject json = new JsonObject ();
3031 json .addProperty ("packName" , "PlaceHolder name" );
3132 json .addProperty ("packId" , "placeholdername" );
33+ json .addProperty ("author" , "Placeholder, author" );
3234 json .addProperty ("version" , "1.0.0" );
3335 json .addProperty ("debug" , false );
3436 JsonObject loaders = new JsonObject ();
@@ -61,6 +63,7 @@ public static JsonObject createDefaultJson() {
6163
6264 private final String packName ;
6365 private final String packId ;
66+ private final String packAuthor ;
6467 private final String version ;
6568 private final Map <String , List <String >> loaderPaths = new Object2ObjectOpenHashMap <>();
6669 private final List <String > packmodeList = new ArrayList <>();
@@ -91,12 +94,19 @@ public RunConfig(JsonObject json) {
9194 name = CaseFormat .LOWER_UNDERSCORE .to (CaseFormat .UPPER_CAMEL , id ).replace ('_' , ' ' );
9295 }
9396 this .packName = name ;
97+ this .packAuthor = JsonHelper .getString (json , "" , "packAuthor" , "author" );
9498 this .packId = id ;
9599 this .version = JsonHelper .getString (json , "1.0.0" , "version" , "ver" );
96100 modMetadata .modId = this .packId ;
97101 modMetadata .name = this .packName ;
98102 modMetadata .version = this .version ;
99103 modMetadata .parent = GroovyScript .ID ;
104+ modMetadata .authorList .addAll (
105+ Arrays .stream (StringUtils .split (this .packAuthor , "," ))
106+ .map (String ::trim )
107+ .filter (s -> !s .isEmpty ())
108+ .collect (Collectors .toList ())
109+ );
100110 }
101111
102112 @ ApiStatus .Internal
0 commit comments