@@ -24,10 +24,9 @@ import com.lambda.threading.runSafe
2424import com.lambda.util.Formatting.asString
2525import com.lambda.util.Formatting.string
2626import com.lambda.util.extension.dimensionName
27+ import com.lambda.util.extension.isNether
2728import com.lambda.util.math.netherCoord
2829import com.lambda.util.math.overworldCoord
29- import net.minecraft.registry.RegistryKey
30- import net.minecraft.world.World
3130
3231object Coordinates : HudModule(
3332 name = " Coordinates" ,
@@ -38,7 +37,7 @@ object Coordinates : HudModule(
3837 private val decimals by setting(" Decimals" , 2 , 0 .. 4 , 1 )
3938
4039 private val SafeContext .text: String
41- get() = " XYZ ${if (showDimension) dimensionName else " " } ${positionForDimension(world.registryKey )} "
40+ get() = " XYZ ${if (showDimension) dimensionName else " " } ${positionForDimension()} "
4241
4342 // TODO: Replace by LambdaAtlas height cache and actually build a proper text with highlighted parameters
4443
@@ -53,9 +52,9 @@ object Coordinates : HudModule(
5352 }
5453 }
5554
56- private fun SafeContext.positionForDimension (dimension : RegistryKey < World > ) =
57- when (dimension) {
58- World . NETHER -> " [ ${player.netherCoord .asString(decimals)} , ${player.netherCoord.z .string} ] ${player.overworldCoord.asString(decimals)} "
59- else -> " ${player.overworldCoord .asString(decimals)} [${player.netherCoord.x.string} , ${player.netherCoord.z.string} ]"
55+ private fun SafeContext.positionForDimension () =
56+ when {
57+ isNether -> " ${player.pos .asString(decimals)} [ ${player.overworldCoord.x .string} ; ${player.overworldCoord.z.string} ] "
58+ else -> " ${player.pos .asString(decimals)} [${player.netherCoord.x.string} ; ${player.netherCoord.z.string} ]"
6059 }
6160}
0 commit comments