Skip to content

Commit 2db2a72

Browse files
authored
fix: apply resource packs in the specified order (#29)
Co-authored-by: Ellet <echo.ellet@gmail.com>
1 parent 1719f6a commit 2db2a72

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

sync-script/src/main/kotlin/syncService/ResourcePacksSyncService.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class ResourcePacksSyncService :
6666
)
6767

6868
if (resourcePackSyncInfo.applyResourcePacks) {
69-
applyResourcePacks()
69+
applyResourcePacks(resourcePacks = resourcePacks)
7070
}
7171

7272
Logger.info {
@@ -191,9 +191,10 @@ class ResourcePacksSyncService :
191191
}
192192
}
193193

194-
private suspend fun applyResourcePacks() {
195-
val resourcePackFilePaths = getScriptLocalResourcePackFilePathsOrAll()
196-
194+
/**
195+
* @param resourcePacks The list of resource packs to apply, the ones that are synced using the script
196+
* */
197+
private fun applyResourcePacks(resourcePacks: List<ResourcePack>) {
197198
MinecraftOptionsManager.loadPropertiesFromFile(createIfMissing = true)
198199

199200
val optionsResourcePacks: List<MinecraftOptionsManager.ResourcePack>? =
@@ -215,8 +216,9 @@ class ResourcePacksSyncService :
215216
userOptionsResourcePacks?.let { addAll(userOptionsResourcePacks) }
216217
}
217218
addAll(
218-
resourcePackFilePaths
219-
.map { MinecraftOptionsManager.ResourcePack.File(it.name) },
219+
resourcePacks.map {
220+
MinecraftOptionsManager.ResourcePack.File(getResourcePackFilePath(it).name)
221+
},
220222
)
221223
},
222224
)

0 commit comments

Comments
 (0)