Skip to content

Commit

Permalink
Fix setting loaders when projects have unusual loaders
Browse files Browse the repository at this point in the history
  • Loading branch information
juraj-hrivnak committed Oct 8, 2024
1 parent f5adf5f commit a9ad32e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ abstract class Platform(

// -- FILES --

val validLoaders = listOf("minecraft", "iris", "optifine", "datapack")

/**
* Requests [project files][ProjectFile] based on [minecraft versions][mcVersions], [loaders], [projectId] or
* [projectId] & [fileId].
Expand Down Expand Up @@ -85,4 +83,9 @@ abstract class Platform(
abstract suspend fun requestMultipleProjectsWithFiles(
mcVersions: List<String>, loaders: List<String>, ids: List<String>, numberOfFiles: Int
): MutableSet<Project>

companion object
{
val validLoaders = listOf("minecraft", "iris", "optifine", "datapack")
}
}
3 changes: 2 additions & 1 deletion src/commonMain/kotlin/teksturepako/pakku/cli/cmd/Set.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.github.ajalt.mordant.terminal.danger
import com.github.ajalt.mordant.terminal.success
import kotlinx.coroutines.runBlocking
import teksturepako.pakku.api.data.LockFile
import teksturepako.pakku.api.platforms.Platform
import teksturepako.pakku.api.projects.ProjectSide
import teksturepako.pakku.api.projects.UpdateStrategy

Expand Down Expand Up @@ -131,7 +132,7 @@ class Set : CliktCommand()
lockFile.getAllProjects().forEach { project ->
for (file in project.files)
{
if (file.loaders.isNotEmpty() && file.loaders.none { it in loaders })
if (file.loaders.isNotEmpty() && file.loaders.none { it in loaders || it in Platform.validLoaders })
{
terminal.danger(
"Can not set to $loaders,"
Expand Down

0 comments on commit a9ad32e

Please sign in to comment.