ResourcePackBuilder

Builds a resource pack based on a ResourcePackConfiguration. A ResourcePackBuilder is responsible for a single resource pack build session.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
lateinit var assetPacks: List<AssetPack>

The AssetPacks of all addons.

Link copied to clipboard
val id: Key

The id of the resource pack.

Link copied to clipboard
val logger: Logger

The logger for this resource pack build session.

Functions

Link copied to clipboard
fun findOrNull(path: ResourcePath<*>): Path?

Searches for a file under path in both the resource pack and vanilla minecraft assets, returning the Path if it exists or null if it doesn't.

Link copied to clipboard

Searches for a file under path in both the resource pack and vanilla minecraft assets, returning the Path if it exists or throwing an IllegalArgumentException if it doesn't.

Link copied to clipboard
inline fun <T : PackBuildData> getBuildData(): T

Retrieves the instantiated PackBuildData of the specified type.

Link copied to clipboard

Creates a Lazy that retrieves an instantiated PackBuildData of the specified type.

Link copied to clipboard

Gets the resource filters for the specified ResourceFilter.Stage.

Link copied to clipboard
inline fun <V> readJson(path: ResourcePath<ResourceType.JsonFile>, json: Json = Json): V?

Deserializes the JSON content of the file under path in the resource pack to V using json, or returns null if the file does not exist.

Link copied to clipboard
inline fun <V> readVanillaJson(path: ResourcePath<ResourceType.JsonFile>, json: Json = Json): V?

Deserializes the JSON content of the file under path in the vanilla minecraft assets to V using json, or returns null if the file does not exist.

Link copied to clipboard
fun resolve(path: String): Path
fun resolve(path: ResourcePath<*>): Path

Resolves the file under path in the resource pack.

Link copied to clipboard

Resolves the corresponding .mcmeta file for the specified path.

Link copied to clipboard

Resolves the file under path in the vanilla minecraft assets.

Link copied to clipboard

Resolves the corresponding .mcmeta file for the specified path in the vanilla minecraft assets.

Link copied to clipboard

Writes the image to the file under path, creating parent directories if necessary.

Link copied to clipboard
inline fun <V> writeJson(path: ResourcePath<ResourceType.JsonFile>, value: V, json: Json = Json)

Serializes value to JSON using json and writes it to the file under path, creating parent directories if necessary.

Link copied to clipboard
inline fun <V> writeMeta(path: ResourcePath<ResourceType.HasMcMeta>, value: V, json: Json = Json)

Serializes value to JSON using json and writes it to the corresponding .mcmeta file for the specified path, creating parent directories if necessary.