Package kr.toxicity.model.api.pack
Interface PackResource
- All Superinterfaces:
Supplier<byte[]>
- All Known Implementing Classes:
PackResource.Packed
Represents a resource within a resource pack.
A resource consists of its content (as a byte array), its path, and optionally the overlay it belongs to.
- Since:
- 1.15.2
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordA simple implementation ofPackResource. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the estimated size of this resource in bytes.static @NotNull PackResourceCreates a new pack resource for the base pack.static @NotNull PackResourceof(@Nullable PackOverlay overlay, @NotNull PackPath path, long size, @NotNull Supplier<byte[]> supplier) Creates a new pack resource for a specific overlay.@Nullable PackOverlayoverlay()Returns the overlay this resource belongs to.@NotNull PackPathpath()Returns the path of this resource.
-
Method Details
-
overlay
Returns the overlay this resource belongs to.- Returns:
- the overlay, or null if it belongs to the base pack
- Since:
- 1.15.2
-
path
Returns the path of this resource.- Returns:
- the pack path
- Since:
- 1.15.2
-
estimatedSize
long estimatedSize()Returns the estimated size of this resource in bytes.- Returns:
- the estimated size
- Since:
- 1.15.2
-
of
@NotNull static @NotNull PackResource of(@NotNull @NotNull PackPath path, long size, @NotNull @NotNull Supplier<byte[]> supplier) Creates a new pack resource for the base pack.- Parameters:
path- the path of the resourcesize- the estimated sizesupplier- the content supplier- Returns:
- the created resource
- Since:
- 1.15.2
-
of
@NotNull static @NotNull PackResource of(@Nullable @Nullable PackOverlay overlay, @NotNull @NotNull PackPath path, long size, @NotNull @NotNull Supplier<byte[]> supplier) Creates a new pack resource for a specific overlay.- Parameters:
overlay- the overlay (or null for base pack)path- the path of the resourcesize- the estimated sizesupplier- the content supplier- Returns:
- the created resource
- Since:
- 1.15.2
-