Command execution position within a function not updated by tp command
When the entity executing a command function is moved by a tp command within that function, subsequent commands within the same function will still be executed at the original position of the entity. For example, a function containing the following commands
tp @s ~ 250 ~
summon minecraft:armor_stand ~ ~ ~
when executed by the player will move the player to y=250 but will summon the armour stand at the player's original position.
I can work around this by prefixing the summon command with execute at @s run but this would mean potentially making this change to every command that might possibly follow a tp of the executing entity.
Environment
Linux Mint 17.3, Oracle Java 1.8.0_151, Nvidia GeForce GT 730, video driver version 384.90
Created Issue:
Command execution position within a function not updated by tp command
When the entity executing a command function is moved by a tp command within that function, subsequent commands within the same function will still be executed at the original position of the entity. For example, a function containing the following commands:
tp @s ~ 250 ~
{NoGravity:1}
summon minecraft:armor_stand ~ ~ ~when executed by the player will move the player to y=250 but will summon the armour stand at the player's original position.
I can work around this by prefixing the summon command with execute at @s run but this would mean potentially making this change to every command that might possibly follow a tp of the executing entity.
Environment
Linux Mint 17.3, Oracle Java 1.8.0_151, Nvidia GeForce GT 730, video driver version 384.90
When the entity executing a command function is moved by a tp command within that function, subsequent commands within the same function will still be executed at the original position of the entity. For example, a function containing the following commands:
tp @s ~ 250 ~
{NoGravity:1}
summon minecraft:armor_stand ~ ~ ~when executed by the player will move the player to y=250 but will summon the armour stand at the player's original position.
I can work around this by prefixing the summon command with execute at @s run but this would mean potentially making this change to every command that might possibly follow a tp of the executing entity.
When the entity executing a command function is moved by a tp command within that function, subsequent commands within the same function will still be executed at the original position of the entity. For example, a function containing the following commands:
{{tp @s ~ 250 ~
{NoGravity:1}
summon minecraft:armor_stand ~ ~ ~}}
when executed by the player will move the player to y=250 but will summon the armour stand at the player's original position.
I can work around this by prefixing the summon command with execute at @s run but this would mean potentially making this change to every command that might possibly follow a tp of the executing entity.
When the entity executing a command function is moved by a tp command within that function, subsequent commands within the same function will still be executed at the original position of the entity. For example, a function containing the following commands:
{{tp @s ~ 250 ~
{NoGravity:1}
summon minecraft:armor_stand ~ ~ ~}}
when executed by the player will move the player to y=250 but will summon the armour stand at the player's original position.
I can work around this by prefixing the summon command with execute at @s run but this would mean potentially making this change to every command that might possibly follow a tp of the executing entity.
When the entity executing a command function is moved by a tp command within that function, subsequent commands within the same function will still be executed at the original position of the entity. For example, a function containing the following commands:
tp @s ~ 250 ~
summon minecraft:armor_stand ~ ~ ~Unknown macro: {NoGravity}when executed by the player will move the player to y=250 but will summon the armour stand at the player's original position.
I can work around this by prefixing the summon command with execute at @s run but this would mean potentially making this change to every command that might possibly follow a tp of the executing entity.
When the entity executing a command function is moved by a tp command within that function, subsequent commands within the same function will still be executed at the original position of the entity. For example, a function containing the following commands
:tp @s ~ 250 ~
summon minecraft:armor_stand ~ ~ ~Unknown macro: {NoGravity}when executed by the player will move the player to y=250 but will summon the armour stand at the player's original position.
I can work around this by prefixing the summon command with execute at @s run but this would mean potentially making this change to every command that might possibly follow a tp of the executing entity.
When the entity executing a command function is moved by a tp command within that function, subsequent commands within the same function will still be executed at the original position of the entity. For example, a function containing the following commands
tp @s ~ 250 ~
summon minecraft:armor_stand ~ ~ ~ {NoGravity:1}
when executed by the player will move the player to y=250 but will summon the armour stand at the player's original position.
I can work around this by prefixing the summon command with execute at @s run but this would mean potentially making this change to every command that might possibly follow a tp of the executing entity.
When the entity executing a command function is moved by a tp command within that function, subsequent commands within the same function will still be executed at the original position of the entity. For example, a function containing the following commands
tp @s ~ 250 ~
summon minecraft:armor_stand ~ ~ ~ {NoGravity:1}
when executed by the player will move the player to y=250 but will summon the armour stand at the player's original position.
I can work around this by prefixing the summon command with execute at @s run but this would mean potentially making this change to every command that might possibly follow a tp of the executing entity.
When the entity executing a command function is moved by a tp command within that function, subsequent commands within the same function will still be executed at the original position of the entity. For example, a function containing the following commands
tp @s ~ 250 ~
{NoGravity:1}
summon minecraft:armor_stand ~ ~ ~when executed by the player will move the player to y=250 but will summon the armour stand at the player's original position.
I can work around this by prefixing the summon command with execute at @s run but this would mean potentially making this change to every command that might possibly follow a tp of the executing entity.
When the entity executing a command function is moved by a tp command within that function, subsequent commands within the same function will still be executed at the original position of the entity. For example, a function containing the following commands
tp @s ~ 250 ~
{NoGravity:1}summon minecraft:armor_stand ~ ~ ~when executed by the player will move the player to y=250 but will summon the armour stand at the player's original position.
I can work around this by prefixing the summon command with execute at @s run but this would mean potentially making this change to every command that might possibly follow a tp of the executing entity.
When the entity executing a command function is moved by a tp command within that function, subsequent commands within the same function will still be executed at the original position of the entity. For example, a function containing the following commands
tp @s ~ 250 ~
summon minecraft:armor_stand ~ ~ ~when executed by the player will move the player to y=250 but will summon the armour stand at the player's original position.
I can work around this by prefixing the summon command with execute at @s run but this would mean potentially making this change to every command that might possibly follow a tp of the executing entity.
is duplicated by
relates to
Duplicate of MC-122726
If you use a function to run two teleportation commands on an entity at once, the entity will only be moved by the final command. Without looking into the code, I'd warrant a guess that each teleportation command is overwritten by the next one (i.e. it applies the transformation to the entities coordinates at the beginning of the tick, not accounting for any previous teleportations), so only the last one actually updates the entities position.
I believe that while it is a separate issue from MC-122118, it is caused by the same underlying problem.
Steps to Recreate
1. Create a function that has 2 commands: "/tp @s ~ ~5 ~" and "/tp @s ~1 ~ ~"
2. Run that function from the chat
3. Notice how the player will only move to the side one block, but will not move up 5 blocks.
EDIT: After reading the resolution for MC-122726 I now believe that this is working as intended. Unfortunately, I cannot seem to delete this post... So, yeah.
The function is ran at the coordinates you specify, not at an entity, it is intentional that it doesn’t move when you move the executor; use execute to update the execution position.