-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support extra data in modrinth packs swap default jvm to openjdk, fix…
… bug when leaving coroutine scope while downloading, minor ui fixes
- Loading branch information
Showing
41 changed files
with
313 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
group=com.mineinabyss | ||
version=2.0.0-alpha.3 | ||
version=2.0.0-alpha.4 | ||
idofrontVersion=0.22.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 9 additions & 7 deletions
16
src/main/kotlin/com/mineinabyss/launchy/data/config/PlayerProfile.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
package com.mineinabyss.launchy.data.config | ||
|
||
import androidx.compose.ui.graphics.ImageBitmap | ||
import androidx.compose.ui.graphics.FilterQuality | ||
import androidx.compose.ui.graphics.painter.BitmapPainter | ||
import androidx.compose.ui.res.loadImageBitmap | ||
import com.mineinabyss.launchy.data.Dirs | ||
import com.mineinabyss.launchy.data.serializers.UUIDSerializer | ||
import com.mineinabyss.launchy.logic.Downloader | ||
import com.mineinabyss.launchy.state.LaunchyState | ||
import kotlinx.coroutines.launch | ||
import kotlinx.serialization.Serializable | ||
import java.util.* | ||
import kotlin.io.path.exists | ||
import kotlin.io.path.inputStream | ||
|
||
@Serializable | ||
data class PlayerProfile( | ||
val name: String, | ||
val uuid: @Serializable(with = UUIDSerializer::class) UUID, | ||
) { | ||
suspend fun getAvatar(): ImageBitmap { | ||
suspend fun getAvatar(state: LaunchyState): BitmapPainter { | ||
val avatarPath = Dirs.avatar(uuid) | ||
|
||
if (!avatarPath.exists()) Downloader.downloadAvatar(uuid) | ||
|
||
return loadImageBitmap(avatarPath.inputStream()) | ||
state.downloadContext.launch { | ||
Downloader.downloadAvatar(uuid) | ||
}.join() | ||
return BitmapPainter(loadImageBitmap(avatarPath.inputStream()), filterQuality = FilterQuality.None) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/com/mineinabyss/launchy/data/modpacks/ExtraPackInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.mineinabyss.launchy.data.modpacks | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
class ModReference( | ||
val urlContains: String, | ||
val info: ModInfo? = null, | ||
) | ||
@Serializable | ||
class ExtraPackInfo( | ||
val groups: List<Group> = listOf(), | ||
val modGroups: Map<String, Set<ModReference>> = mapOf(), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
src/main/kotlin/com/mineinabyss/launchy/data/modpacks/Modpack.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
package com.mineinabyss.launchy.data.modpacks | ||
|
||
import com.mineinabyss.launchy.data.config.GameInstance | ||
import java.nio.file.Path | ||
|
||
class Modpack( | ||
val dependencies: PackDependencies, | ||
val mods: Mods, | ||
val overridesPath: Path? = null, | ||
val overridesPaths: List<Path> = listOf(), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/kotlin/com/mineinabyss/launchy/data/modpacks/formats/ExtraInfoFormat.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.mineinabyss.launchy.data.modpacks.formats | ||
|
||
import com.mineinabyss.launchy.data.modpacks.ExtraPackInfo | ||
import com.mineinabyss.launchy.data.modpacks.Group | ||
import com.mineinabyss.launchy.data.modpacks.Mod | ||
import com.mineinabyss.launchy.data.modpacks.Mods | ||
import java.nio.file.Path | ||
|
||
|
||
data class ExtraInfoFormat( | ||
val format: PackFormat, | ||
val extraInfoPack: ExtraPackInfo, | ||
) : PackFormat by format { | ||
override fun toGenericMods(minecraftDir: Path): Mods { | ||
val originalMods = format.toGenericMods(minecraftDir) | ||
val foundMods = mutableSetOf<Mod>() | ||
val mods: Map<Group, Set<Mod>> = extraInfoPack.modGroups | ||
.mapKeys { (name, _) -> extraInfoPack.groups.single { it.name == name } } | ||
.mapValues { (_, mods) -> | ||
mods.mapNotNull { ref -> | ||
val found = originalMods.mods.find { mod -> ref.urlContains in mod.info.url } | ||
if (found != null) foundMods.add(found) | ||
if (found != null && ref.info != null) | ||
found.copy(info = ref.info.copy(url = found.info.url)) | ||
else found | ||
}.toSet() | ||
} | ||
|
||
val originalGroups = originalMods.modGroups.mapValues { | ||
it.value.filterTo(mutableSetOf()) { mod -> mod !in foundMods } | ||
} | ||
return Mods(originalGroups + mods) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.