Class PackCodec

java.lang.Object
org.geysermc.geyser.api.pack.PackCodec
Direct Known Subclasses:
PathPackCodec, UrlPackCodec

public abstract class PackCodec extends Object
Represents a pack codec that can be used to provide resource packs to clients.
Since:
2.1.1
  • Constructor Details

    • PackCodec

      public PackCodec()
  • Method Details

    • sha256

      public abstract byte @NonNull [] sha256()
      Gets the sha256 hash of the resource pack.
      Returns:
      the hash of the resource pack
      Since:
      2.1.1
    • size

      public abstract long size()
      Gets the resource pack size.
      Returns:
      the resource pack file size
      Since:
      2.1.1
    • serialize

      @Deprecated public @NonNull SeekableByteChannel serialize(@NonNull ResourcePack resourcePack) throws IOException
      Deprecated.
      use serialize() instead.
      Throws:
      IOException
    • serialize

      public abstract @NonNull SeekableByteChannel serialize() throws IOException
      Serializes the given codec into a byte buffer.
      Returns:
      the serialized resource pack
      Throws:
      IOException
      Since:
      2.6.2
    • create

      protected abstract @NonNull ResourcePack create()
      Creates a new resource pack from this codec.
      Returns:
      the new resource pack
      Since:
      2.1.1
    • createBuilder

      protected abstract @NonNull ResourcePack.Builder createBuilder()
      Creates a new resource pack builder from this codec.
      Returns:
      the new resource pack builder
      Since:
      2.6.2
    • path

      public static @NonNull PathPackCodec path(@NonNull Path path)
      Creates a new pack provider from the given path.
      Parameters:
      path - the path to create the pack provider from
      Returns:
      the new pack provider
      Since:
      2.1.1
    • url

      public static @NonNull UrlPackCodec url(@NonNull String url)
      Creates a new pack provider from the given url.
      Parameters:
      url - the url to create the pack provider from
      Returns:
      the new pack provider
      Since:
      2.6.2