Skip to content

Commit

Permalink
fix: apply resource packs in the specified order (#29)
Browse files Browse the repository at this point in the history
Co-authored-by: Ellet <[email protected]>
  • Loading branch information
EchoEllet authored Aug 22, 2024
1 parent 1719f6a commit 2db2a72
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ResourcePacksSyncService :
)

if (resourcePackSyncInfo.applyResourcePacks) {
applyResourcePacks()
applyResourcePacks(resourcePacks = resourcePacks)
}

Logger.info {
Expand Down Expand Up @@ -191,9 +191,10 @@ class ResourcePacksSyncService :
}
}

private suspend fun applyResourcePacks() {
val resourcePackFilePaths = getScriptLocalResourcePackFilePathsOrAll()

/**
* @param resourcePacks The list of resource packs to apply, the ones that are synced using the script
* */
private fun applyResourcePacks(resourcePacks: List<ResourcePack>) {
MinecraftOptionsManager.loadPropertiesFromFile(createIfMissing = true)

val optionsResourcePacks: List<MinecraftOptionsManager.ResourcePack>? =
Expand All @@ -215,8 +216,9 @@ class ResourcePacksSyncService :
userOptionsResourcePacks?.let { addAll(userOptionsResourcePacks) }
}
addAll(
resourcePackFilePaths
.map { MinecraftOptionsManager.ResourcePack.File(it.name) },
resourcePacks.map {
MinecraftOptionsManager.ResourcePack.File(getResourcePackFilePath(it).name)
},
)
},
)
Expand Down

0 comments on commit 2db2a72

Please sign in to comment.