Skip to content

Commit

Permalink
Merge branch 'neoforge' into prs
Browse files Browse the repository at this point in the history
  • Loading branch information
burningtnt committed Jan 5, 2024
2 parents 6013e0b + 2a6093f commit 6ea618c
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,32 @@ public boolean hasType() {

@Override
public CompletableFuture<?> loadAsync() {
throw new UnsupportedOperationException("NeoForgedBMCLVersionList does not support loading the entire Forge remote version list.");
throw new UnsupportedOperationException("NeoForgedBMCLVersionList does not support loading the entire NeoForge remote version list.");
}

@Override
public CompletableFuture<?> refreshAsync() {
throw new UnsupportedOperationException("NeoForgedBMCLVersionList does not support loading the entire Forge remote version list.");
throw new UnsupportedOperationException("NeoForgedBMCLVersionList does not support loading the entire NeoForge remote version list.");
}

@Override
public CompletableFuture<?> refreshAsync(String gameVersion) {
return CompletableFuture.completedFuture((Void) null)
.thenApplyAsync(wrap(unused -> HttpRequest.GET(apiRoot + "/neoforge/list/" + gameVersion).<List<NeoForgedVersion>>getJson(new TypeToken<List<NeoForgedVersion>>(){}.getType())))
.thenApplyAsync(wrap(unused -> HttpRequest.GET(apiRoot + "/neoforge/list/" + gameVersion).<List<NeoForgedVersion>>getJson(new TypeToken<List<NeoForgedVersion>>() {
}.getType())))
.thenAcceptAsync(neoForgedVersions -> {
lock.writeLock().lock();

try {
versions.clear(gameVersion);
for (NeoForgedVersion neoForgedVersion : neoForgedVersions) {
String nf = StringUtils.removePrefix(
neoForgedVersion.version,
"1.20.1".equals(gameVersion) ? "1.20.1-forge-" : "neoforge-" // Som of the version numbers for 1.20.1 are like forge.
);
versions.put(gameVersion, new NeoForgedRemoteVersion(
neoForgedVersion.mcVersion,
neoForgedVersion.version,
nf,
Lang.immutableListOf(
apiRoot + "/neoforge/version/" + neoForgedVersion.version + "/download/installer.jar"
)
Expand Down

0 comments on commit 6ea618c

Please sign in to comment.