Class ResourcePackLoader

java.lang.Object
org.geysermc.geyser.registry.loader.ResourcePackLoader
All Implemented Interfaces:
RegistryLoader<Path,Map<String,org.geysermc.geyser.api.pack.ResourcePack>>

public class ResourcePackLoader extends Object implements RegistryLoader<Path,Map<String,org.geysermc.geyser.api.pack.ResourcePack>>
Loads ResourcePacks within a Path directory, firing the GeyserLoadResourcePacksEvent.
  • Constructor Details

    • ResourcePackLoader

      public ResourcePackLoader()
  • Method Details

    • load

      public Map<String,org.geysermc.geyser.api.pack.ResourcePack> load(Path directory)
      Loop through the packs directory and locate valid resource pack files
      Specified by:
      load in interface RegistryLoader<Path,Map<String,org.geysermc.geyser.api.pack.ResourcePack>>
      Parameters:
      directory - the input
      Returns:
      the output
    • readPack

      public static GeyserResourcePack readPack(Path path) throws IllegalArgumentException
      Reads a resource pack 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 representation
      Throws:
      IllegalArgumentException - if the pack manifest was invalid or there was any processing exception