mojira.dev
MC-277417

/tp no longer works when run from a command block without context from "execute as"

The /teleport command no longer works without execute as context. Here are some examples of commands that do and do not work when run through command blocks:

The following example commands do not work:

/tp @a 1 2 3
/tp @p ~ ~5 ~
/teleport @n[type=armor_stand] 1 2 3
/execute run tp @a ~ ~5 ~

The following example command does work:

/execute as @a run tp @s ~ ~5 ~

All commands that do not work give the following output: 

An unexpected error occurred trying to execute that command

 

All teleport commands in chat inherently work because they execute as the player typing them.

Linked issues

Comments 3

This occurs due to the fix of MC-277019, which incorrectly references CommandSourceStack.getEntity() in cases where there is no source entity. The teleport command should only care about the target entity. See MC-277419.

I experience the same bug

Only seems to affect /tp and not /spreadplayers.

TheWorfer27

gegy

Confirmed

Platform

Very Important

Commands

command

1.21.2 Pre-Release 1

1.21.2 Pre-Release 2

Retrieved