diff --git a/api/src/main/java/org/geysermc/geyser/api/pack/UrlPackCodec.java b/api/src/main/java/org/geysermc/geyser/api/pack/UrlPackCodec.java
index e6d1a5a24..b98e59355 100644
--- a/api/src/main/java/org/geysermc/geyser/api/pack/UrlPackCodec.java
+++ b/api/src/main/java/org/geysermc/geyser/api/pack/UrlPackCodec.java
@@ -27,10 +27,22 @@ package org.geysermc.geyser.api.pack;
import org.checkerframework.checker.nullness.qual.NonNull;
+/**
+ * Represents a pack codec that creates a resource
+ * pack from a URL.
+ *
+ * Due to Bedrock limitations, the URL must:
+ *
+ * - be a direct download link to a .zip or .mcpack resource pack
+ * - Use application type `application/zip` and set a correct content length
+ *
+ *
+ * Additionally, the ResourcePack must be zipped in a folder enclosing the resource pack, instead of the resource pack being at the root of the zip.
+ */
public abstract class UrlPackCodec extends PackCodec {
/**
- * Gets the URL of the resource pack.
+ * Gets the URL to the resource pack location.
*
* @return the URL of the resource pack
*/
@@ -40,7 +52,7 @@ public abstract class UrlPackCodec extends PackCodec {
/**
* If the remote pack has an encryption key, it must be specified here.
* Otherwise, leave empty.
- *
+ * @return the encryption key of the resource pack
*/
@NonNull
public abstract String contentKey();
diff --git a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java
index 2e94993e7..2c37006f9 100644
--- a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java
+++ b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java
@@ -279,9 +279,8 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
// Check for packs that the client should normally download on its own. If the client cannot find the pack, we provide it instead.
if (codec instanceof UrlPackCodec urlPackCodec) {
if (!GameProtocol.isPre1_20_30(this.session)) {
- // TODO: Proper pack checking - could be that the remote url is offline, the pack changed, or.. something?
- GeyserImpl.getInstance().getLogger().warning("Received ResourcePackChunkRequestPacket for URL pack " + urlPackCodec.url());
-
+ GeyserImpl.getInstance().getLogger().warning("Received a request for a remote pack that the client should have already downloaded!" +
+ "Is the pack at the URL " + urlPackCodec.url() + " still available?");
WebUtils.checkUrlAndDownloadRemotePack(urlPackCodec.url());
}
}
diff --git a/core/src/main/java/org/geysermc/geyser/pack/url/GeyserUrlPackCodec.java b/core/src/main/java/org/geysermc/geyser/pack/url/GeyserUrlPackCodec.java
index 1f40408eb..0a60f2ce9 100644
--- a/core/src/main/java/org/geysermc/geyser/pack/url/GeyserUrlPackCodec.java
+++ b/core/src/main/java/org/geysermc/geyser/pack/url/GeyserUrlPackCodec.java
@@ -92,7 +92,7 @@ public class GeyserUrlPackCodec extends UrlPackCodec {
throw new IllegalArgumentException("Unable to download pack from " + url, e);
}
}
- return ResourcePackLoader.loadDownloadedPack(this);
+ return ResourcePackLoader.readPack(this);
}
@Override
diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/ResourcePackLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/ResourcePackLoader.java
index 3e92bd34f..79933264e 100644
--- a/core/src/main/java/org/geysermc/geyser/registry/loader/ResourcePackLoader.java
+++ b/core/src/main/java/org/geysermc/geyser/registry/loader/ResourcePackLoader.java
@@ -113,7 +113,7 @@ public class ResourcePackLoader implements RegistryLoader loadCdnEntries() {
+ public Map loadRemotePacks() {
final Path cachedCdnPacksDirectory = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("remote_packs");
// Download CDN packs to get the pack uuid's
@@ -230,8 +230,7 @@ public class ResourcePackLoader implements RegistryLoader downloadPack(String url) throws IllegalArgumentException {
- CompletableFuture future = WebUtils.checkUrlAndDownloadRemotePack(url);
- future.whenCompleteAsync((cachedPath, throwable) -> {
+ return WebUtils.checkUrlAndDownloadRemotePack(url).whenCompleteAsync((cachedPath, throwable) -> {
if (cachedPath == null) {
return;
}
@@ -263,6 +262,5 @@ public class ResourcePackLoader implements RegistryLoader