Port to 1.20.2

This commit is contained in:
nea
2023-09-25 19:24:16 +02:00
parent 2bd3ed1e23
commit 139089d9be
13 changed files with 124 additions and 77 deletions

View File

@@ -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 {

View File

@@ -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

View File

@@ -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 {

View File

@@ -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))