diff options
author | nea <nea@nea.moe> | 2023-09-25 19:24:16 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-09-25 19:24:46 +0200 |
commit | 139089d9beb134465737c4afff3b1303bf481aa1 (patch) | |
tree | ca2582bee8d9988afe9ca4f6ed70b043d47aaf3a /src/main/kotlin/moe/nea/firmament | |
parent | 2bd3ed1e238d75c4a185656ac6fd857ac6897a99 (diff) | |
download | Firmament-139089d9beb134465737c4afff3b1303bf481aa1.tar.gz Firmament-139089d9beb134465737c4afff3b1303bf481aa1.tar.bz2 Firmament-139089d9beb134465737c4afff3b1303bf481aa1.zip |
Port to 1.20.2
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament')
4 files changed, 19 insertions, 11 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/apis/UrsaManager.kt b/src/main/kotlin/moe/nea/firmament/apis/UrsaManager.kt index 8288283..a78b423 100644 --- a/src/main/kotlin/moe/nea/firmament/apis/UrsaManager.kt +++ b/src/main/kotlin/moe/nea/firmament/apis/UrsaManager.kt @@ -50,8 +50,8 @@ object UrsaManager { withContext(Dispatchers.IO) { val mc = MinecraftClient.getInstance() val serverId = UUID.randomUUID().toString() - mc.sessionService.joinServer(mc.session.profile, mc.session.accessToken, serverId) - header("x-ursa-username", mc.session.profile.name) + mc.sessionService.joinServer(mc.session.uuidOrNull, mc.session.accessToken, serverId) + header("x-ursa-username", mc.session.username) header("x-ursa-serverid", serverId) } } else { diff --git a/src/main/kotlin/moe/nea/firmament/features/inventory/storageoverlay/StorageOverlayScreen.kt b/src/main/kotlin/moe/nea/firmament/features/inventory/storageoverlay/StorageOverlayScreen.kt index 63ce134..8251c92 100644 --- a/src/main/kotlin/moe/nea/firmament/features/inventory/storageoverlay/StorageOverlayScreen.kt +++ b/src/main/kotlin/moe/nea/firmament/features/inventory/storageoverlay/StorageOverlayScreen.kt @@ -102,9 +102,14 @@ class StorageOverlayScreen() : Screen(Text.empty()) { return page.inventory?.rows?.let { it * 19 + MC.font.fontHeight + 2 } ?: 60 } - override fun mouseScrolled(mouseX: Double, mouseY: Double, amount: Double): Boolean { + override fun mouseScrolled( + mouseX: Double, + mouseY: Double, + horizontalAmount: Double, + verticalAmount: Double + ): Boolean { scroll = - (scroll + amount * StorageOverlay.config.scrollSpeed * + (scroll + horizontalAmount * StorageOverlay.config.scrollSpeed * (if (StorageOverlay.config.inverseScroll) 1 else -1)).toInt() .coerceAtMost(lastRenderedHeight - height + 2 * StorageOverlay.config.margin).coerceAtLeast(0) return true diff --git a/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt b/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt index eda6130..6c877ec 100644 --- a/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt +++ b/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt @@ -13,7 +13,11 @@ import io.github.moulberry.repo.NEURepositoryException import io.github.moulberry.repo.data.NEUItem import io.github.moulberry.repo.data.NEURecipe import io.github.moulberry.repo.data.Rarity +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents import kotlinx.coroutines.launch +import net.minecraft.client.MinecraftClient +import net.minecraft.network.packet.s2c.play.SynchronizeRecipesS2CPacket +import net.minecraft.text.Text import moe.nea.firmament.Firmament import moe.nea.firmament.Firmament.logger import moe.nea.firmament.gui.config.ManagedConfig @@ -21,10 +25,6 @@ import moe.nea.firmament.hud.ProgressBar import moe.nea.firmament.rei.PetData import moe.nea.firmament.util.MinecraftDispatcher import moe.nea.firmament.util.SkyblockId -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents -import net.minecraft.client.MinecraftClient -import net.minecraft.network.packet.s2c.play.SynchronizeRecipesS2CPacket -import net.minecraft.text.Text object RepoManager { object Config : ManagedConfig("repo") { @@ -54,8 +54,10 @@ object RepoManager { var recentlyFailedToUpdateItemList = false - val progressBar = ProgressBar("", null, 0).also { - it.setSize(180, 22) + val progressBar by lazy { + ProgressBar("", null, 0).also { + it.setSize(180, 22) + } } val neuRepo: NEURepository = NEURepository.of(RepoDownloadManager.repoSavedLocation).apply { diff --git a/src/main/kotlin/moe/nea/firmament/util/ScoreboardUtil.kt b/src/main/kotlin/moe/nea/firmament/util/ScoreboardUtil.kt index afbdd82..b437357 100644 --- a/src/main/kotlin/moe/nea/firmament/util/ScoreboardUtil.kt +++ b/src/main/kotlin/moe/nea/firmament/util/ScoreboardUtil.kt @@ -8,6 +8,7 @@ package moe.nea.firmament.util import java.util.Optional import net.minecraft.scoreboard.Scoreboard +import net.minecraft.scoreboard.ScoreboardDisplaySlot import net.minecraft.scoreboard.Team import net.minecraft.text.StringVisitable import net.minecraft.text.Style @@ -16,7 +17,7 @@ import net.minecraft.util.Formatting fun getScoreboardLines(): List<Text> { val scoreboard = MC.player?.scoreboard ?: return listOf() - val activeObjective = scoreboard.getObjectiveForSlot(Scoreboard.SIDEBAR_DISPLAY_SLOT_ID) ?: return listOf() + val activeObjective = scoreboard.getObjectiveForSlot(ScoreboardDisplaySlot.SIDEBAR) ?: return listOf() return scoreboard.getAllPlayerScores(activeObjective).reversed().take(15).map { val team = scoreboard.getPlayerTeam(it.playerName) Team.decorateName(team, Text.literal(it.playerName)) |