Skip to content

Commit

Permalink
download version manifest in case it does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceWalkerRS committed Dec 26, 2023
1 parent 941800d commit ce60063
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main/java/net/ornithemc/ploceus/PloceusGradleExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,22 @@ public String normalizedMinecraftVersion() {
Path userCache = loom.getFiles().getUserCache().toPath();
Path manifestCache = userCache.resolve("version_manifest.json");

try (BufferedReader br = new BufferedReader(new FileReader(manifestCache.toFile()))) {
Manifest manifest = GSON.fromJson(br, Manifest.class);
Manifest.Version version = manifest.getVersion(versionId);
try {
loom.download(Constants.VERSION_MANIFEST_URL).downloadPath(manifestCache);

String detailsUrl = version.details();
Path detailsCache = userCache.resolve(versionId).resolve("minecraft-details.json");
try (BufferedReader br = new BufferedReader(new FileReader(manifestCache.toFile()))) {
Manifest manifest = GSON.fromJson(br, Manifest.class);
Manifest.Version version = manifest.getVersion(versionId);

loom.download(detailsUrl).downloadPath(detailsCache);
String detailsUrl = version.details();
Path detailsCache = userCache.resolve(versionId).resolve("minecraft-details.json");

try (BufferedReader _br = new BufferedReader(new FileReader(detailsCache.toFile()))) {
VersionDetails details = GSON.fromJson(_br, VersionDetails.class);
return details.normalizedVersion();
loom.download(detailsUrl).downloadPath(detailsCache);

try (BufferedReader _br = new BufferedReader(new FileReader(detailsCache.toFile()))) {
VersionDetails details = GSON.fromJson(_br, VersionDetails.class);
return details.normalizedVersion();
}
}
} catch (Exception e) {
project.getLogger().warn("unable to read version details, cannot normalize minecraft version id", e);
Expand Down

0 comments on commit ce60063

Please sign in to comment.