Class PackCodec

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

public abstract class PackCodec extends Object
Represents a pack codec that can be used to provide resource packs to clients.
  • 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
    • size

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

      public abstract @NonNull SeekableByteChannel serialize(@NonNull ResourcePack resourcePack) throws IOException
      Serializes the given resource pack into a byte buffer.
      Parameters:
      resourcePack - the resource pack to serialize
      Returns:
      the serialized resource pack
      Throws:
      IOException
    • create

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

      public static @NonNull PackCodec 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