From 05d3ce74bda883ad14abfdda8b5fe25e3a70d2cd Mon Sep 17 00:00:00 2001 From: Xikaro Date: Wed, 21 May 2025 19:11:56 +0500 Subject: [PATCH 1/5] Update RunConfig.java --- .../java/com/cleanroommc/groovyscript/sandbox/RunConfig.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java index 1b4d0dc20..f67f7347f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java @@ -29,6 +29,7 @@ public static JsonObject createDefaultJson() { JsonObject json = new JsonObject(); json.addProperty("packName", "PlaceHolder name"); json.addProperty("packId", "placeholdername"); + json.addProperty("author", "Placeholder author"); json.addProperty("version", "1.0.0"); json.addProperty("debug", false); JsonObject loaders = new JsonObject(); @@ -61,6 +62,7 @@ public static JsonObject createDefaultJson() { private final String packName; private final String packId; + private final String packAuthor; private final String version; private final Map> loaderPaths = new Object2ObjectOpenHashMap<>(); private final List packmodeList = new ArrayList<>(); @@ -85,16 +87,19 @@ public static boolean isGroovyFile(String path) { public RunConfig(JsonObject json) { String name = JsonHelper.getString(json, "", "packName", "name"); String id = JsonHelper.getString(json, "", "packId", "id"); + String author = JsonHelper.getString(json, "", "packAuthor", "author"); Pattern idPattern = Pattern.compile("[a-z_]+"); this.invalidPackId = id.isEmpty() || !idPattern.matcher(id).matches(); if (name.isEmpty() && !this.invalidPackId) { name = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, id).replace('_', ' '); } this.packName = name; + this.packAuthor = author; this.packId = id; this.version = JsonHelper.getString(json, "1.0.0", "version", "ver"); modMetadata.modId = this.packId; modMetadata.name = this.packName; + modMetadata.credits = this.packAuthor; modMetadata.version = this.version; modMetadata.parent = GroovyScript.ID; } From dcbd54104c0b1e4fc3d5b2f321ce61b822512b9f Mon Sep 17 00:00:00 2001 From: Xikaro Date: Wed, 21 May 2025 19:18:02 +0500 Subject: [PATCH 2/5] Update runConfig.json --- examples/runConfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/runConfig.json b/examples/runConfig.json index c807aeeaa..92a74152c 100644 --- a/examples/runConfig.json +++ b/examples/runConfig.json @@ -1,6 +1,7 @@ { "packName": "GroovyScript Dev", "packId": "groovyscriptdev", + "author": "Placeholder author", "version": "1.0.0", "debug": true, "loaders": { From 3fb8c6cfa8e61761e70905ac834eaeb8da46cb7b Mon Sep 17 00:00:00 2001 From: Xikaro Date: Wed, 21 May 2025 19:25:34 +0500 Subject: [PATCH 3/5] Update RunConfig.java --- .../java/com/cleanroommc/groovyscript/sandbox/RunConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java index f67f7347f..03db94f28 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java @@ -99,7 +99,7 @@ public RunConfig(JsonObject json) { this.version = JsonHelper.getString(json, "1.0.0", "version", "ver"); modMetadata.modId = this.packId; modMetadata.name = this.packName; - modMetadata.credits = this.packAuthor; + modMetadata.authorList = Collections.singletonList(this.packAuthor); modMetadata.version = this.version; modMetadata.parent = GroovyScript.ID; } From 87acf7db0ea88ecc29cb68e77107686f84c24e0b Mon Sep 17 00:00:00 2001 From: Xikaro Date: Wed, 21 May 2025 19:45:06 +0500 Subject: [PATCH 4/5] fix: authorList --- examples/runConfig.json | 24 +++++++------------ .../groovyscript/sandbox/RunConfig.java | 13 ++++++---- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/examples/runConfig.json b/examples/runConfig.json index 92a74152c..3a73fbf5d 100644 --- a/examples/runConfig.json +++ b/examples/runConfig.json @@ -1,28 +1,22 @@ { - "packName": "GroovyScript Dev", - "packId": "groovyscriptdev", - "author": "Placeholder author", + "packName": "PlaceHolder name", + "packId": "placeholdername", + "author": "Placeholder, author", "version": "1.0.0", - "debug": true, + "debug": false, "loaders": { "preInit": [ "classes/", "preInit/" ], - "init": [ - "init/" - ], "postInit": [ - "postInit/", - "recipes/" + "postInit/" ] }, "packmode": { - "values": [ - "normal", - "hard" - ], - "default": "normal", + "values": [], + "default": "", + "_comment": "By default the packmode is not synced with the packmode mod. You can enable integration, but you can no longer change packmode on the fly.", "integratePackmodeMod": false } -} +} \ No newline at end of file diff --git a/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java b/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java index 03db94f28..a7df063c4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java +++ b/src/main/java/com/cleanroommc/groovyscript/sandbox/RunConfig.java @@ -15,6 +15,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModMetadata; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.ApiStatus; @@ -29,7 +30,7 @@ public static JsonObject createDefaultJson() { JsonObject json = new JsonObject(); json.addProperty("packName", "PlaceHolder name"); json.addProperty("packId", "placeholdername"); - json.addProperty("author", "Placeholder author"); + json.addProperty("author", "Placeholder, author"); json.addProperty("version", "1.0.0"); json.addProperty("debug", false); JsonObject loaders = new JsonObject(); @@ -87,21 +88,25 @@ public static boolean isGroovyFile(String path) { public RunConfig(JsonObject json) { String name = JsonHelper.getString(json, "", "packName", "name"); String id = JsonHelper.getString(json, "", "packId", "id"); - String author = JsonHelper.getString(json, "", "packAuthor", "author"); Pattern idPattern = Pattern.compile("[a-z_]+"); this.invalidPackId = id.isEmpty() || !idPattern.matcher(id).matches(); if (name.isEmpty() && !this.invalidPackId) { name = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, id).replace('_', ' '); } this.packName = name; - this.packAuthor = author; + this.packAuthor = JsonHelper.getString(json, "", "packAuthor", "author"); this.packId = id; this.version = JsonHelper.getString(json, "1.0.0", "version", "ver"); modMetadata.modId = this.packId; modMetadata.name = this.packName; - modMetadata.authorList = Collections.singletonList(this.packAuthor); modMetadata.version = this.version; modMetadata.parent = GroovyScript.ID; + modMetadata.authorList.addAll( + Arrays.stream(StringUtils.split(this.packAuthor, ",")) + .map(String::trim) + .filter(s -> !s.isEmpty()) + .collect(Collectors.toList()) + ); } @ApiStatus.Internal From 84a9939f260e78ca77f6989b603ea059766e9490 Mon Sep 17 00:00:00 2001 From: Xikaro Date: Wed, 21 May 2025 19:59:29 +0500 Subject: [PATCH 5/5] Revert runConfig --- examples/runConfig.json | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/examples/runConfig.json b/examples/runConfig.json index 3a73fbf5d..0bc83cf70 100644 --- a/examples/runConfig.json +++ b/examples/runConfig.json @@ -1,22 +1,28 @@ { - "packName": "PlaceHolder name", - "packId": "placeholdername", - "author": "Placeholder, author", + "packName": "GroovyScript Dev", + "packId": "groovyscriptdev", + "author": "GroovyScript, Dev, Author", "version": "1.0.0", - "debug": false, + "debug": true, "loaders": { "preInit": [ "classes/", "preInit/" ], + "init": [ + "init/" + ], "postInit": [ - "postInit/" + "postInit/", + "recipes/" ] }, "packmode": { - "values": [], - "default": "", - "_comment": "By default the packmode is not synced with the packmode mod. You can enable integration, but you can no longer change packmode on the fly.", + "values": [ + "normal", + "hard" + ], + "default": "normal", "integratePackmodeMod": false } -} \ No newline at end of file +}