mojira.dev
MCPE-93229

Caret notation in execute command is treated as tilde notation in functions.

THE BUG

When using the caret notation in functions (eg. execute @a ^ ^ ^), it is treated as tilde notation. The command "execute @p ^ ^ ^10 tp @e[type=cow] ~ ~ ~" should teleport all cows in front of the player. This command works correctly when using command blocks but when used in functions, it moves the cows to the south of the player instead.  If the command "execute @a ^ ^ ^5 tp @e[type=cow] ~ ~ ~" is typed into a command block,  all the cows will teleport 5 blocks in the direction the player is looking. This is the intended result.

A work around this would be this command: "execute @p ~ ~ ~ tp @e[type=cow] ^ ^ ^10". This works exactly as the command "execute @p ^ ^ ^10 tp @e[type=cow] ~ ~ ~". I briefly tested it and the work around is applicable to other commands other than spreadplayers. Kindly test this work around for further information. I have attached a behavior pack for further testing.

 

HOW TO REPRODUCE

The Bug

  1. In a .mcfunction file, type "execute @a ^ ^ ^5 tp @e[type=cow] ~ ~ ~". Then save the function as 'test'. The behavior pack for download contains the function too.

  2. . Make a behavior pack containing the function. 

  3. Load in the behavior pack.

  4. Place a command block and input in the command 'function test'.

  5. Set the command block type to Repeat and redstone to Always Active.

  6. All cows will teleport 5 blocks south of the player instead of where to players is looking.

 The Work around

  1. In a .mcfunction file, type "execute @a ~ ~ ~ tp @e[type=cow] ^ ^ ^5". Then save the function as 'test'. The behavior pack for download contains the function too.

  2. Follow the instructions 2-3 from above.

  3. Place a command block and input in the command 'function workaround'.

  4. Set the command block type to Repeat and redstone to Always Active.

  5. All cows will teleport 5 blocs in front of the player.

Linked issues

Attachments

Comments 10

This is still an issue in the current release.

This seems related to MCPE-43866 and MCPE-29942

To describe this slightly more simply using the example from MCPE-43866.

The command below works as intended when run from chat and from command blocks in the world.

The caret notation however does not work as intended when the command is in a function file or animation file. In these cases it behaves as if they are tilde notation.

/execute @p ^ ^ ^5 summon cow

A behaviour pack for your testing that loads the above command into a function.

[media]

To test load the pack and run the command. It should spawn a cow in front of you but it will instead spawn a cow to the south of you.

/function caret_test

Edit: Just realised I used @p but this also effects the other selectors

This is a legacy behavior bug that is intentionally versioned for "backward compatibility", you need to update your pack format version to 2 to get the proper behavior.

Awesome thanks.

In the end I had to update the format version in the behaviour pack to 2 and increase the min_engine_version as well. Just in case anyone finds this issue in the future.

 

I think this bug can be marked as fixed

@unknown regarding @unknown last comment do you think we can close your ticket?

So the bug is still there
https://youtu.be/kv03WzuKJ0s

 
And the Formast version 2 does not load the add-on because minecarft will no longer recognize it as an add-on

Sorry The bug is fixed 

But if you have format Version 2 

and no min_engine_version (like me the bug is that the addon doesn't exist)

[media]

Sorry the bug is fix but I cann't use becuse some functions do not work in Fromat Version 2 

I can send it to you, if no one get the add-on 

Can you fix it in Format Version 1, please?

Thank you for your report!

However, this issue has been temporarily closed as Awaiting Response.

Is this still an issue in the latest version? If yes, can you please add it to the affected versions (or mention it if you are not the reporter)?

This ticket will automatically reopen when you reply.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

Cleaning up old tickets: This ticket had been set to 'Awaiting Response', but has not received a response from the reporter (~3 months+) so is being closed as Incomplete. If you feel this is still a valid issue then please comment, or create a new ticket following the Issue Guidelines which includes steps to reproduce the problem.

For any account or purchasing related issues, please contact Minecraft Customer Support directly, as we cannot assist with those here at the bug tracker.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

Can confirm in 1.20.0


Note that workaround.mcfunction in the supplied behaviour pack uses the reporter's username, so doesn't work until you edit it to @a.

Ross David Tan

(Unassigned)

Unconfirmed

Multiple

1.16.10, 1.16.221 Hotfix

Retrieved