Package kr.toxicity.model.api.pack
Class PackResult
java.lang.Object
kr.toxicity.model.api.pack.PackResult
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 -
Method Summary
Modifier and TypeMethodDescriptionassets()Returns the base assets of the pack.booleanchanged()Checks if the pack content has changed.@Nullable FileReturns the output directory of the pack.voidfreeze()Freezes the result, preventing further modifications.voidfreeze(boolean changed) Freezes the result and sets the changed status.@NotNull UUIDhash()Calculates and returns the SHA-256 hash of the pack content as a UUID.@NotNull PackMetameta()Returns the pack metadata.overlays(@NotNull PackOverlay overlay) Returns the resources for a specific overlay.voidset(@Nullable PackOverlay overlay, @NotNull PackByte packByte) Adds a resource to the result.intsize()Returns the total number of resources in the pack.stream()Returns a stream of all resources in the pack.longtime()Returns the time elapsed since the result was created.
-
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
Returns the pack metadata.- Returns:
- the pack metadata
- Since:
- 1.15.2
-
directory
Returns the output directory of the pack.- Returns:
- the directory, or null if not applicable
- Since:
- 1.15.2
-
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
Returns a stream of all resources in the pack.- Returns:
- the stream of resources
- Since:
- 1.15.2
-
assets
Returns the base assets of the pack.- Returns:
- the set of assets
- Since:
- 1.15.2
-