15
15
import net .minecraft .util .ResourceLocation ;
16
16
import net .minecraftforge .fml .common .Loader ;
17
17
import net .minecraftforge .fml .common .ModMetadata ;
18
+ import org .apache .commons .lang3 .StringUtils ;
18
19
import org .apache .commons .lang3 .tuple .Pair ;
19
20
import org .jetbrains .annotations .ApiStatus ;
20
21
@@ -29,6 +30,7 @@ public static JsonObject createDefaultJson() {
29
30
JsonObject json = new JsonObject ();
30
31
json .addProperty ("packName" , "PlaceHolder name" );
31
32
json .addProperty ("packId" , "placeholdername" );
33
+ json .addProperty ("author" , "Placeholder, author" );
32
34
json .addProperty ("version" , "1.0.0" );
33
35
json .addProperty ("debug" , false );
34
36
JsonObject loaders = new JsonObject ();
@@ -61,6 +63,7 @@ public static JsonObject createDefaultJson() {
61
63
62
64
private final String packName ;
63
65
private final String packId ;
66
+ private final String packAuthor ;
64
67
private final String version ;
65
68
private final Map <String , List <String >> loaderPaths = new Object2ObjectOpenHashMap <>();
66
69
private final List <String > packmodeList = new ArrayList <>();
@@ -91,12 +94,19 @@ public RunConfig(JsonObject json) {
91
94
name = CaseFormat .LOWER_UNDERSCORE .to (CaseFormat .UPPER_CAMEL , id ).replace ('_' , ' ' );
92
95
}
93
96
this .packName = name ;
97
+ this .packAuthor = JsonHelper .getString (json , "" , "packAuthor" , "author" );
94
98
this .packId = id ;
95
99
this .version = JsonHelper .getString (json , "1.0.0" , "version" , "ver" );
96
100
modMetadata .modId = this .packId ;
97
101
modMetadata .name = this .packName ;
98
102
modMetadata .version = this .version ;
99
103
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
+ );
100
110
}
101
111
102
112
@ ApiStatus .Internal
0 commit comments