File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/main/kotlin/com/github/quiltservertools/ledger/commands/subcommands Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import net.minecraft.server.command.CommandManager
1212import net.minecraft.server.world.ServerWorld
1313
1414object TeleportCommand : BuildableCommand {
15+ private const val BLOCK_CENTER_OFFSET = 0.5
1516 override fun build (): LiteralNode =
1617 CommandManager .literal(" tp" )
1718 .requires(Permissions .require(" ledger.commands.tp" , CommandConsts .PERMISSION_LEVEL ))
@@ -33,11 +34,15 @@ object TeleportCommand : BuildableCommand {
3334 private fun teleport (context : Context , world : ServerWorld , posArg : PosArgument ): Int {
3435 val player = context.source.playerOrThrow
3536 val pos = posArg.toAbsoluteBlockPos(context.source)
37+
38+ val x = pos.x.toDouble() + BLOCK_CENTER_OFFSET
39+ val z = pos.z.toDouble() + BLOCK_CENTER_OFFSET
40+
3641 player.teleport(
3742 world,
38- pos.x.toDouble() ,
43+ x ,
3944 pos.y.toDouble(),
40- pos.z.toDouble() ,
45+ z ,
4146 emptySet(),
4247 player.yaw,
4348 player.pitch,
You can’t perform that action at this time.
0 commit comments