Interface PackResource

All Superinterfaces:
Supplier<byte[]>
All Known Implementing Classes:
PackResource.Packed

public interface PackResource extends Supplier<byte[]>
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 Classes
    Modifier and Type
    Interface
    Description
    static final record 
    A simple implementation of PackResource.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the estimated size of this resource in bytes.
    static @NotNull PackResource
    of(@NotNull PackPath path, long size, @NotNull Supplier<byte[]> supplier)
    Creates a new pack resource for the base pack.
    static @NotNull PackResource
    of(@Nullable PackOverlay overlay, @NotNull PackPath path, long size, @NotNull Supplier<byte[]> supplier)
    Creates a new pack resource for a specific overlay.
    @Nullable PackOverlay
    Returns the overlay this resource belongs to.
    @NotNull PackPath
    Returns the path of this resource.

    Methods inherited from interface java.util.function.Supplier

    get
  • Method Details

    • overlay

      @Nullable @Nullable PackOverlay 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

      @NotNull @NotNull PackPath 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 resource
      size - the estimated size
      supplier - 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 resource
      size - the estimated size
      supplier - the content supplier
      Returns:
      the created resource
      Since:
      1.15.2