ResourcePack

class ResourcePack(var meta: ResourcePackMeta, var outputDir: File, var assetResolutionStrategy: AssetResolutionStrategy, _elements: MutableList<ResourcePackElement> = mutableListOf(), _hooks: MutableList<PackedHook> = mutableListOf())

A resource pack, containing several ResourcePackElements.

Constructors

Link copied to clipboard
constructor(meta: ResourcePackMeta, outputDir: File, assetResolutionStrategy: AssetResolutionStrategy, _elements: MutableList<ResourcePackElement> = mutableListOf(), _hooks: MutableList<PackedHook> = mutableListOf())

Properties

Link copied to clipboard

The strategy used to resolve assets.

Link copied to clipboard
val elements: @UnmodifiableView List<ResourcePackElement>

The fonts in the pack.

Link copied to clipboard
val hooks: @UnmodifiableView List<PackedHook>

The hooks in the pack.

Link copied to clipboard

The resource pack metadata.

Link copied to clipboard

The output directory of the resource pack, it will be saved here.

Functions

Link copied to clipboard
fun addBasicSound(soundKey: Key): SoundList

Adds a basic sound to this pack.

Adds a basic sound to this resource pack. A basic sound will be saved to the first (or a new) sound list of the same namespace of the sound.

fun addBasicSound(key: Key, block: SoundEvent.() -> Unit): SoundList

Builds and adds a basic sound to this resource pack.

Link copied to clipboard
fun <T : ResourcePackElement> addElement(element: T): T

Adds a resource pack element to this pack.

Link copied to clipboard
inline fun addFont(block: Font.() -> Unit): Font
fun addFont(font: Font): Font

Adds a font to the pack.

Link copied to clipboard

Adds a translation to each Minecraft language.

Link copied to clipboard

Adds an item definition to this resource pack.

Link copied to clipboard
inline fun addItemModel(key: Key, block: ItemModel.Builder.() -> Unit): ItemModel

Adds an item model to this resource pack.

Link copied to clipboard
fun addLanguage(language: Language): Language

Adds a language to this resource pack.

Link copied to clipboard
fun addSounds(soundList: SoundList): SoundList

Adds the given sound list to the resource pack.

fun addSounds(namespace: String? = null, block: SoundList.() -> Unit): SoundList

Builds a sound list from the given namespace and adds it to the resource pack.

Link copied to clipboard
fun addTranslation(languageKey: Key, key: String, value: String): Language

Adds a translation to a specified language of this resource pack.

Link copied to clipboard
fun createZip(outputFile: File)

Creates a zip of the output directory.

Link copied to clipboard
fun install(hook: PackedHook)

Installs a hook.

Link copied to clipboard
fun save(deleteOld: Boolean = false)

Saves the entire pack. Should only be called after having added everything.