Class ResourcePackLoader
java.lang.Object
org.geysermc.geyser.registry.loader.ResourcePackLoader
- All Implemented Interfaces:
RegistryLoader<Path,Map<UUID, ResourcePackHolder>>
public class ResourcePackLoader
extends Object
implements RegistryLoader<Path,Map<UUID,ResourcePackHolder>>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic voidclear()static CompletableFuture<@NonNull org.geysermc.geyser.api.pack.PathPackCodec>downloadPack(String url, boolean testing) Loop through the packs directory and locate valid resource pack filesstatic GeyserResourcePack.BuilderReads a resource pack builder at the given file.static GeyserResourcePack.BuilderreadPack(GeyserUrlPackCodec codec) Reads a Resource pack from a URL codec, and returns a resource pack.static voidtestRemotePack(GeyserSession session, org.geysermc.geyser.api.pack.UrlPackCodec codec, UUID packId, String packVersion) Used when a Bedrock client requests a Bedrock resource pack from the server when it should be downloading it from a remote provider.
-
Constructor Details
-
ResourcePackLoader
public ResourcePackLoader()
-
-
Method Details
-
load
Loop through the packs directory and locate valid resource pack files- Specified by:
loadin interfaceRegistryLoader<Path,Map<UUID, ResourcePackHolder>> - Parameters:
directory- the input- Returns:
- the output
-
readPack
Reads a resource pack builder at the given file. Also searches for a file in the same directory, with the same name but suffixed by ".key", containing the content key. If such file does not exist, no content key is stored.- Parameters:
path- the file to read from, in ZIP format- Returns:
- a
ResourcePack.Builderrepresentation - Throws:
IllegalArgumentException- if the pack manifest was invalid or there was any processing exception
-
readPack
public static GeyserResourcePack.Builder readPack(GeyserUrlPackCodec codec) throws IllegalArgumentException Reads a Resource pack from a URL codec, and returns a resource pack. UnlikereadPack(Path)this method reads content keys differently.- Parameters:
codec- the URL pack codec with the url to download the pack from- Returns:
- a
GeyserResourcePackrepresentation - Throws:
IllegalArgumentException- if there was an error reading the pack.
-
testRemotePack
public static void testRemotePack(GeyserSession session, org.geysermc.geyser.api.pack.UrlPackCodec codec, UUID packId, String packVersion) Used when a Bedrock client requests a Bedrock resource pack from the server when it should be downloading it from a remote provider. Since this would be called each time a Bedrock client requests a piece of the Bedrock pack, this uses a cache to ensure we aren't re-checking a dozen times.- Parameters:
codec- the codec of the resource pack that wasn't successfully downloaded by a Bedrock client.
-
downloadPack
public static CompletableFuture<@NonNull org.geysermc.geyser.api.pack.PathPackCodec> downloadPack(String url, boolean testing) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
clear
public static void clear() -
cleanupRemotePacks
public static void cleanupRemotePacks()
-