Class PackResult

java.lang.Object
kr.toxicity.model.api.pack.PackResult

public final class PackResult extends Object
Represents the result of a pack building process.

This class holds the generated pack metadata, the output directory, and the collection of generated resources (assets and overlays). It also provides methods to calculate the pack hash and check for changes.

Since:
1.15.2
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull @Unmodifiable Set<PackByte>
    Returns the base assets of the pack.
    boolean
    Checks if the pack content has changed.
    @Nullable File
    Returns the output directory of the pack.
    void
    Freezes the result, preventing further modifications.
    void
    freeze(boolean changed)
    Freezes the result and sets the changed status.
    @NotNull UUID
    Calculates and returns the SHA-256 hash of the pack content as a UUID.
    @NotNull PackMeta
    Returns the pack metadata.
    @NotNull @Unmodifiable Set<PackByte>
    overlays(@NotNull PackOverlay overlay)
    Returns the resources for a specific overlay.
    void
    set(@Nullable PackOverlay overlay, @NotNull PackByte packByte)
    Adds a resource to the result.
    int
    Returns the total number of resources in the pack.
    @NotNull Stream<PackByte>
    Returns a stream of all resources in the pack.
    long
    Returns the time elapsed since the result was created.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PackResult

      public PackResult()
  • Method Details

    • set

      @Internal public void set(@Nullable @Nullable PackOverlay overlay, @NotNull @NotNull PackByte packByte)
      Adds a resource to the result.
      Parameters:
      overlay - the overlay the resource belongs to (or null for base assets)
      packByte - the resource data
      Throws:
      IllegalStateException - if the result is frozen
      Since:
      1.15.2
    • freeze

      public void freeze()
      Freezes the result, preventing further modifications.
      Since:
      1.15.2
    • changed

      public boolean changed()
      Checks if the pack content has changed.
      Returns:
      true if changed, false otherwise
      Since:
      1.15.2
    • freeze

      public void freeze(boolean changed)
      Freezes the result and sets the changed status.
      Parameters:
      changed - whether the pack content has changed
      Throws:
      IllegalStateException - if the result is already frozen
      Since:
      1.15.2
    • meta

      @NotNull public @NotNull PackMeta meta()
      Returns the pack metadata.
      Returns:
      the pack metadata
      Since:
      1.15.2
    • directory

      @Nullable public @Nullable File directory()
      Returns the output directory of the pack.
      Returns:
      the directory, or null if not applicable
      Since:
      1.15.2
    • hash

      @NotNull public @NotNull UUID hash()
      Calculates and returns the SHA-256 hash of the pack content as a UUID.
      Returns:
      the hash UUID
      Since:
      1.15.2
    • size

      public int size()
      Returns the total number of resources in the pack.
      Returns:
      the size
      Since:
      1.15.2
    • time

      public long time()
      Returns the time elapsed since the result was created.
      Returns:
      the elapsed time in milliseconds
      Since:
      1.15.2
    • overlays

      @NotNull public @NotNull @Unmodifiable Set<PackByte> overlays(@NotNull @NotNull PackOverlay overlay)
      Returns the resources for a specific overlay.
      Parameters:
      overlay - the overlay
      Returns:
      the set of resources
      Since:
      1.15.2
    • stream

      @NotNull public @NotNull Stream<PackByte> stream()
      Returns a stream of all resources in the pack.
      Returns:
      the stream of resources
      Since:
      1.15.2
    • assets

      @NotNull public @NotNull @Unmodifiable Set<PackByte> assets()
      Returns the base assets of the pack.
      Returns:
      the set of assets
      Since:
      1.15.2