aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/dulkirfabric/util
diff options
context:
space:
mode:
authorInglett <inglettronald@gmail.com>2024-01-18 14:58:23 -0600
committerInglett <inglettronald@gmail.com>2024-01-18 14:58:23 -0600
commit2249182df19085e14c5bd29d466331228677ad3c (patch)
tree26028db9ab5c6803665ee6446517d2bbf96fa9a5 /src/main/kotlin/com/dulkirfabric/util
parent2d8f0f28c9b7f1f778a689ce14591136fb0490dd (diff)
downloadDulkirMod-Fabric-2249182df19085e14c5bd29d466331228677ad3c.tar.gz
DulkirMod-Fabric-2249182df19085e14c5bd29d466331228677ad3c.tar.bz2
DulkirMod-Fabric-2249182df19085e14c5bd29d466331228677ad3c.zip
bump mod to 1.20.4 support
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/util')
-rw-r--r--src/main/kotlin/com/dulkirfabric/util/ScoreBoardUtils.kt18
-rw-r--r--src/main/kotlin/com/dulkirfabric/util/Utils.kt3
2 files changed, 10 insertions, 11 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/util/ScoreBoardUtils.kt b/src/main/kotlin/com/dulkirfabric/util/ScoreBoardUtils.kt
index c62cbab..d8acd4b 100644
--- a/src/main/kotlin/com/dulkirfabric/util/ScoreBoardUtils.kt
+++ b/src/main/kotlin/com/dulkirfabric/util/ScoreBoardUtils.kt
@@ -23,12 +23,12 @@ object ScoreBoardUtils {
fun getLines(): MutableList<String>? {
val scoreboard = DulkirModFabric.mc.player?.scoreboard ?: return null
// This returns null if we're not in skyblock curiously
- val sidebarObjective = scoreboard.getObjective("SBScoreboard") ?: return null
- val scores = scoreboard.getAllPlayerScores(sidebarObjective)
+ val sidebarObjective = scoreboard.getNullableObjective("SBScoreboard") ?: return null
+ val scores = scoreboard.getScoreboardEntries(sidebarObjective)
val lines: MutableList<String> = ArrayList()
for (score in scores.reversed()) {
- val team = scoreboard.getPlayerTeam(score.playerName)
- var str = Team.decorateName(team, Text.literal(score.playerName)).string
+ val team = scoreboard.getTeam(score.owner)
+ var str = Team.decorateName(team, Text.literal(score.owner)).string
.replace("ยง[^a-f0-9]".toRegex(), "")
lines.add(str)
}
@@ -42,12 +42,12 @@ object ScoreBoardUtils {
fun getLinesWithColor(): MutableList<String>? {
val scoreboard = DulkirModFabric.mc.player?.scoreboard ?: return null
// This returns null if we're not in skyblock curiously
- val sidebarObjective = scoreboard.getObjective("SBScoreboard") ?: return null
- val scores = scoreboard.getAllPlayerScores(sidebarObjective)
+ val sidebarObjective = scoreboard.getNullableObjective("SBScoreboard") ?: return null
+ val scores = scoreboard.getScoreboardEntries(sidebarObjective)
val lines: MutableList<String> = ArrayList()
for (score in scores.reversed()) {
- val team = scoreboard.getPlayerTeam(score.playerName)
- lines.add(Team.decorateName(team, Text.literal(score.playerName)).formattedString())
+ val team = scoreboard.getTeam(score.owner)
+ lines.add(Team.decorateName(team, Text.literal(score.owner)).formattedString())
}
return lines
}
@@ -97,7 +97,7 @@ object ScoreBoardUtils {
if (event.sound.id.path != "entity.wither.shoot") return
if (event.sound.pitch != 0.6984127f) return
if (event.sound.volume != .5f) return
- SlayerBossEvents.Spawn(slayerType?: return err()).post()
+ SlayerBossEvents.Spawn(slayerType ?: return err()).post()
}
fun err() {
diff --git a/src/main/kotlin/com/dulkirfabric/util/Utils.kt b/src/main/kotlin/com/dulkirfabric/util/Utils.kt
index a0fec78..342dc48 100644
--- a/src/main/kotlin/com/dulkirfabric/util/Utils.kt
+++ b/src/main/kotlin/com/dulkirfabric/util/Utils.kt
@@ -6,7 +6,6 @@ import com.dulkirfabric.events.WorldLoadEvent
import com.dulkirfabric.events.chat.ChatEvents
import meteordevelopment.orbit.EventHandler
import net.minecraft.block.entity.SkullBlockEntity
-import net.minecraft.client.texture.PlayerSkinProvider
import net.minecraft.entity.Entity
import net.minecraft.item.ItemStack
import net.minecraft.nbt.NbtHelper
@@ -74,6 +73,6 @@ object Utils {
fun getSkullTexture(itemStack: ItemStack): String? {
return itemStack.getSubNbt(SkullBlockEntity.SKULL_OWNER_KEY)?.let(NbtHelper::toGameProfile)?.properties?.get(
- PlayerSkinProvider.TEXTURES)?.first()?.value
+ "textures")?.first()?.value
}
} \ No newline at end of file