Skip to content

Commit fd5e4b1

Browse files
committed
Fix asset URI
1 parent 67d8958 commit fd5e4b1

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/main/java/org/spongepowered/gradle/vanilla/internal/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public final class Constants {
4747
public static final String NAME = "VanillaGradle";
4848
public static final String VERSION = Constants.version();
4949
public static final String USER_AGENT = String.format("%s/%s Gradle/%s", Constants.NAME, Constants.VERSION, GradleVersion.current().getVersion());
50-
public static final String MINECRAFT_RESOURCES_HOST = "resources.download.minecraft.net";
50+
public static final String MINECRAFT_RESOURCES_BASE = "https://resources.download.minecraft.net/";
5151
public static final String TASK_GROUP = "vanilla gradle";
5252
public static final int ASM_VERSION = Opcodes.ASM9;
5353
public static final Instant MIN_MC_VERSION_TIMESTAMP = Instant.from(DateTimeFormatter.ISO_DATE_TIME.parse("2025-12-16T12:42:29+00:00"));

src/main/java/org/spongepowered/gradle/vanilla/task/DownloadAssetsTask.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@ public void execute() {
109109

110110
// Send out all the requests
111111
for (final Map.Entry<String, AssetIndex.Asset> asset : index.objects().entrySet()) {
112+
final String fileName = asset.getValue().fileName();
112113
results.add(objectDownloader.downloadAndValidate(
113-
this.assetUri(asset.getValue()),
114-
asset.getValue().fileName(),
114+
URI.create(Constants.MINECRAFT_RESOURCES_BASE + fileName),
115+
fileName,
115116
HashAlgorithm.SHA1,
116117
asset.getValue().hash()
117118
)
@@ -159,13 +160,4 @@ public void execute() {
159160
stats.upToDate()
160161
);
161162
}
162-
163-
private URI assetUri(final AssetIndex.Asset asset) {
164-
try {
165-
return new URI("https", Constants.MINECRAFT_RESOURCES_HOST, '/' + asset.fileName());
166-
} catch (final URISyntaxException ex) {
167-
throw new IllegalArgumentException("Failed to parse asset URI for " + asset.hash(), ex);
168-
}
169-
}
170-
171163
}

0 commit comments

Comments
 (0)