mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 05:27:43 -05:00
Fix to support new mod.json format
This commit is contained in:
@@ -26,6 +26,7 @@ package net.fabricmc.loom;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.fabricmc.loom.task.DownloadTask;
|
||||
@@ -273,17 +274,19 @@ public class AbstractPlugin implements Plugin<Project> {
|
||||
Gson gson = new Gson();
|
||||
try {
|
||||
JsonElement jsonElement = gson.fromJson(new FileReader(modJson), JsonElement.class);
|
||||
JsonObject jsonObject = jsonElement.getAsJsonObject();
|
||||
if ((extension.version == null || extension.version.isEmpty()) && jsonObject.has("version")) {
|
||||
project.setVersion(jsonObject.get("version").getAsString());
|
||||
JsonArray jsonArray = jsonElement.getAsJsonArray();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JsonObject jsonObject = jsonArray.get(i).getAsJsonObject();
|
||||
if ((extension.version == null || extension.version.isEmpty()) && jsonObject.has("version")) {
|
||||
project.setVersion(jsonObject.get("version").getAsString());
|
||||
}
|
||||
if (jsonObject.has("group")) {
|
||||
project.setGroup(jsonObject.get("group").getAsString());
|
||||
}
|
||||
if (jsonObject.has("description")) {
|
||||
project.setDescription(jsonObject.get("description").getAsString());
|
||||
}
|
||||
}
|
||||
if (jsonObject.has("group")) {
|
||||
project.setGroup(jsonObject.get("group").getAsString());
|
||||
}
|
||||
if (jsonObject.has("description")) {
|
||||
project.setDescription(jsonObject.get("description").getAsString());
|
||||
}
|
||||
//TODO load deps
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
//This wont happen as we have checked for it
|
||||
|
||||
Reference in New Issue
Block a user