Package org.geysermc.geyser.api.pack
Class PackCodec
java.lang.Object
org.geysermc.geyser.api.pack.PackCodec
- Direct Known Subclasses:
PathPackCodec
Represents a pack codec that can be used
to provide resource packs to clients.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract @NonNull ResourcePackcreate()Creates a new resource pack from this codec.static @NonNull PackCodecCreates a new pack provider from the given path.abstract @NonNull SeekableByteChannelserialize(@NonNull ResourcePack resourcePack)Serializes the given resource pack into a byte buffer.abstract byte @NonNull []sha256()Gets the sha256 hash of the resource pack.abstract longsize()Gets the resource pack size.
-
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 IOExceptionSerializes the given resource pack into a byte buffer.- Parameters:
resourcePack- the resource pack to serialize- Returns:
- the serialized resource pack
- Throws:
IOException
-
create
Creates a new resource pack from this codec.- Returns:
- the new resource pack
-
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
-