aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features/world/NavigationHelper.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-11-17 19:55:02 +0100
committerLinnea Gräf <nea@nea.moe>2025-11-17 19:55:02 +0100
commitc93a04a001b0f66b2724d46b04b6d1ed49a08d07 (patch)
tree5869ca70acc482ef0362f27785c3d3f1cbb9ffae /src/main/kotlin/features/world/NavigationHelper.kt
parentaf9893b59407c69d31ebd2ed513f0396ab4d2dc9 (diff)
downloadFirmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.gz
Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.bz2
Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.zip
refactor: port to mojmaps
Diffstat (limited to 'src/main/kotlin/features/world/NavigationHelper.kt')
-rw-r--r--src/main/kotlin/features/world/NavigationHelper.kt24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main/kotlin/features/world/NavigationHelper.kt b/src/main/kotlin/features/world/NavigationHelper.kt
index acdfb86..ea886bf 100644
--- a/src/main/kotlin/features/world/NavigationHelper.kt
+++ b/src/main/kotlin/features/world/NavigationHelper.kt
@@ -1,10 +1,10 @@
package moe.nea.firmament.features.world
import io.github.moulberry.repo.constants.Islands
-import net.minecraft.text.Text
-import net.minecraft.util.math.BlockPos
-import net.minecraft.util.math.Position
-import net.minecraft.util.math.Vec3i
+import net.minecraft.network.chat.Component
+import net.minecraft.core.BlockPos
+import net.minecraft.core.Position
+import net.minecraft.core.Vec3i
import moe.nea.firmament.annotations.Subscribe
import moe.nea.firmament.events.SkyblockServerUpdateEvent
import moe.nea.firmament.events.TickEvent
@@ -72,7 +72,7 @@ object NavigationHelper {
fun onMovement(event: TickEvent) { // TODO: add a movement tick event maybe?
val tp = targetWaypoint ?: return
val p = MC.player ?: return
- if (p.squaredDistanceTo(tp.position.toCenterPos()) < 5 * 5) {
+ if (p.distanceToSqr(tp.position.center) < 5 * 5) {
targetWaypoint = null
}
}
@@ -84,11 +84,11 @@ object NavigationHelper {
RenderInWorldContext.renderInWorld(event) {
if (nt != null) {
waypoint(nt.blockPos,
- Text.literal("Teleporter to " + nt.toIsland.userFriendlyName),
- Text.literal("(towards " + tp.name + "§f)"))
+ Component.literal("Teleporter to " + nt.toIsland.userFriendlyName),
+ Component.literal("(towards " + tp.name + "§f)"))
} else if (tp.island == SBData.skyblockLocation) {
waypoint(tp.position,
- Text.literal(tp.name))
+ Component.literal(tp.name))
}
}
}
@@ -96,7 +96,7 @@ object NavigationHelper {
fun tryWarpNear() {
val tp = targetWaypoint
if (tp == null) {
- MC.sendChat(Text.literal("Could not find a waypoint to warp you to. Select one first."))
+ MC.sendChat(Component.literal("Could not find a waypoint to warp you to. Select one first."))
return
}
WarpUtil.teleportToNearestWarp(tp.island, tp.position.asPositionView())
@@ -106,15 +106,15 @@ object NavigationHelper {
fun Vec3i.asPositionView(): Position {
return object : Position {
- override fun getX(): Double {
+ override fun x(): Double {
return this@asPositionView.x.toDouble()
}
- override fun getY(): Double {
+ override fun y(): Double {
return this@asPositionView.y.toDouble()
}
- override fun getZ(): Double {
+ override fun z(): Double {
return this@asPositionView.z.toDouble()
}
}