Fix to support new mod.json format
parent
d13f33d0f3
commit
f1a00533ad
|
@ -26,6 +26,7 @@ package net.fabricmc.loom;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import net.fabricmc.loom.task.DownloadTask;
|
import net.fabricmc.loom.task.DownloadTask;
|
||||||
|
@ -273,17 +274,19 @@ public class AbstractPlugin implements Plugin<Project> {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
try {
|
try {
|
||||||
JsonElement jsonElement = gson.fromJson(new FileReader(modJson), JsonElement.class);
|
JsonElement jsonElement = gson.fromJson(new FileReader(modJson), JsonElement.class);
|
||||||
JsonObject jsonObject = jsonElement.getAsJsonObject();
|
JsonArray jsonArray = jsonElement.getAsJsonArray();
|
||||||
if ((extension.version == null || extension.version.isEmpty()) && jsonObject.has("version")) {
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
project.setVersion(jsonObject.get("version").getAsString());
|
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) {
|
} catch (FileNotFoundException e) {
|
||||||
//This wont happen as we have checked for it
|
//This wont happen as we have checked for it
|
||||||
|
|
Loading…
Reference in New Issue