diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-11-17 19:55:02 +0100 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-11-17 19:55:02 +0100 |
| commit | c93a04a001b0f66b2724d46b04b6d1ed49a08d07 (patch) | |
| tree | 5869ca70acc482ef0362f27785c3d3f1cbb9ffae /src/main/kotlin/util/WarpUtil.kt | |
| parent | af9893b59407c69d31ebd2ed513f0396ab4d2dc9 (diff) | |
| download | Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.gz Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.bz2 Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.zip | |
refactor: port to mojmaps
Diffstat (limited to 'src/main/kotlin/util/WarpUtil.kt')
| -rw-r--r-- | src/main/kotlin/util/WarpUtil.kt | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/kotlin/util/WarpUtil.kt b/src/main/kotlin/util/WarpUtil.kt index 6783fa1..3008592 100644 --- a/src/main/kotlin/util/WarpUtil.kt +++ b/src/main/kotlin/util/WarpUtil.kt @@ -6,8 +6,8 @@ import kotlinx.serialization.Serializable import kotlinx.serialization.serializer import kotlin.math.sqrt import kotlin.time.Duration.Companion.seconds -import net.minecraft.text.Text -import net.minecraft.util.math.Position +import net.minecraft.network.chat.Component +import net.minecraft.core.Position import moe.nea.firmament.annotations.Subscribe import moe.nea.firmament.commands.thenExecute import moe.nea.firmament.events.CommandEvent @@ -45,25 +45,25 @@ object WarpUtil { } private fun squaredDist(pos: Position, warp: Warp): Double { - val dx = pos.x - warp.x - val dy = pos.y - warp.y - val dz = pos.z - warp.z + val dx = pos.x() - warp.x + val dy = pos.y() - warp.y + val dz = pos.z() - warp.z return dx * dx + dy * dy + dz * dz } fun teleportToNearestWarp(island: SkyBlockIsland, pos: Position) { val nearestWarp = findNearestWarp(island, pos) if (nearestWarp == null) { - MC.sendChat(Text.translatable("firmament.warp-util.no-warp-found", island.userFriendlyName)) + MC.sendChat(Component.translatable("firmament.warp-util.no-warp-found", island.userFriendlyName)) return } if (island == SBData.skyblockLocation - && sqrt(squaredDist(pos, nearestWarp)) > 1.1 * sqrt(squaredDist((MC.player ?: return).pos, nearestWarp)) + && sqrt(squaredDist(pos, nearestWarp)) > 1.1 * sqrt(squaredDist((MC.player ?: return).position, nearestWarp)) ) { - MC.sendChat(Text.translatable("firmament.warp-util.already-close", nearestWarp.warp)) + MC.sendChat(Component.translatable("firmament.warp-util.already-close", nearestWarp.warp)) return } - MC.sendChat(Text.translatable("firmament.warp-util.attempting-to-warp", nearestWarp.warp)) + MC.sendChat(Component.translatable("firmament.warp-util.attempting-to-warp", nearestWarp.warp)) lastWarpAttempt = TimeMark.now() lastAttemptedWarp = nearestWarp.warp MC.sendCommand("warp ${nearestWarp.warp}") @@ -75,7 +75,7 @@ object WarpUtil { thenExecute { DConfig.data?.excludedWarps?.clear() DConfig.markDirty() - source.sendFeedback(Text.translatable("firmament.warp-util.clear-excluded")) + source.sendFeedback(Component.translatable("firmament.warp-util.clear-excluded")) } } } @@ -87,7 +87,7 @@ object WarpUtil { ) { DConfig.data?.excludedWarps?.add(lastAttemptedWarp) DConfig.markDirty() - MC.sendChat(Text.stringifiedTranslatable("firmament.warp-util.mark-excluded", lastAttemptedWarp)) + MC.sendChat(Component.translatableEscape("firmament.warp-util.mark-excluded", lastAttemptedWarp)) lastWarpAttempt = TimeMark.farPast() } if (it.unformattedString.startsWith("You may now fast travel to")) { |
