aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-07-01 03:42:51 +0200
committerLinnea Gräf <nea@nea.moe>2024-07-03 21:05:51 +0200
commit5ee4b8d925eb12e068038a1fd2e1f35cdd8ef87e (patch)
treea5b0a6fbc8878ae62bb2c3a01dbb255388353fda /src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt
parentdff1f9c0e2b728dba902d72816104abccc61f511 (diff)
downloadfirmament-5ee4b8d925eb12e068038a1fd2e1f35cdd8ef87e.tar.gz
firmament-5ee4b8d925eb12e068038a1fd2e1f35cdd8ef87e.tar.bz2
firmament-5ee4b8d925eb12e068038a1fd2e1f35cdd8ef87e.zip
[WIP] Remove LibGUI
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt')
-rw-r--r--src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt b/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt
index db17e6a..f556a8b 100644
--- a/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt
+++ b/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt
@@ -6,7 +6,6 @@
package moe.nea.firmament.repo
-import io.github.cottonmc.cotton.gui.client.CottonHud
import io.github.moulberry.repo.NEURecipeCache
import io.github.moulberry.repo.NEURepository
import io.github.moulberry.repo.NEURepositoryException
@@ -21,7 +20,6 @@ import net.minecraft.text.Text
import moe.nea.firmament.Firmament
import moe.nea.firmament.Firmament.logger
import moe.nea.firmament.gui.config.ManagedConfig
-import moe.nea.firmament.hud.ProgressBar
import moe.nea.firmament.rei.PetData
import moe.nea.firmament.util.MinecraftDispatcher
import moe.nea.firmament.util.SkyblockId
@@ -54,12 +52,6 @@ object RepoManager {
var recentlyFailedToUpdateItemList = false
- val progressBar by lazy {
- ProgressBar("", null, 0).also {
- it.setSize(180, 22)
- }
- }
-
val neuRepo: NEURepository = NEURepository.of(RepoDownloadManager.repoSavedLocation).apply {
registerReloadListener(ItemCache)
registerReloadListener(ExpLadders)
@@ -98,14 +90,13 @@ object RepoManager {
fun launchAsyncUpdate(force: Boolean = false) {
Firmament.coroutineScope.launch {
- progressBar.reportProgress("Downloading", 0, null)
- CottonHud.add(progressBar)
+ ItemCache.ReloadProgressHud.reportProgress("Downloading", 0, -1) // TODO: replace with a proper boundy bar
+ ItemCache.ReloadProgressHud.isEnabled = true
try {
RepoDownloadManager.downloadUpdate(force)
- progressBar.reportProgress("Download complete", 1, 1)
+ ItemCache.ReloadProgressHud.reportProgress("Download complete", 1, 1)
} finally {
- CottonHud.remove(progressBar)
-
+ ItemCache.ReloadProgressHud.isEnabled = false
}
reload()
}
@@ -113,14 +104,14 @@ object RepoManager {
fun reload() {
try {
- progressBar.reportProgress("Reloading from Disk", 0, null)
- CottonHud.add(progressBar)
+ ItemCache.ReloadProgressHud.reportProgress("Reloading from Disk", 0, -1) // TODO: replace with a proper boundy bar
+ ItemCache.ReloadProgressHud.isEnabled = true
neuRepo.reload()
} catch (exc: NEURepositoryException) {
MinecraftClient.getInstance().player?.sendMessage(
Text.literal("Failed to reload repository. This will result in some mod features not working.")
)
- CottonHud.remove(progressBar)
+ ItemCache.ReloadProgressHud.isEnabled = false
exc.printStackTrace()
}
}