The bug
The following commands are supposed to be indistinguishable:
/function cmd
/execute @s ~ ~ ~ function cmd
However, this is not the case for some functions.
Consider the following function:
tp @s ~ ~5 ~
setblock ~ ~ ~ stone
The expected behavior this function is that you are teleported 5 blocks up, then stone is placed on the ground where you used to be. If this seems confusing, please understand that relative coordinates are relative to the position the command was run from, not the position of @s
. This is well-established and works correctly in many other situations.
The function works differently depending on if you put /execute @s ~ ~ ~
in front of it, breaking the first assumption. With the /execute
, it works correctly, but without it, it fails, teleporting the player ten blocks in the air.
How to reproduce
1. Download and open the attached world
2. /execute @s ~ ~ ~ function teleport_block
→ ✔ The block was placed on the ground
3. /function teleport_test
→ ❌ The block was placed in mid-air
Linked issues
relates to
Attachments
Comments
As of 1.10, the first example is fixed, but the second is not.
Cleaning up old tickets: This ticket has not been updated recently (~1 year+) so is being closed as Cannot Reproduce. If you feel this is still a valid issue then please comment, or create a new ticket following the Issue Guidelines.
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki
The second example is still an issue
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 so, please add a comment or update the affected version field.
To make your bug report as effective as possible, please try and include the following steps to reproduce the problem:
Steps to Reproduce:
1.
2.
3.Observed Results:
(Briefly describe what happens)Expected Results:
(Briefly describe what should happen)
If your ticket does not look like the example given here, then it's likely to be closed as incomplete.
This ticket will automatically reopen when you reply.
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki
Still an issue

Thank you for your report!
After consideration, the issue is being closed as Working as Intended.
Please note, that mechanics of the game may change between updates.
Things such as graphics, sounds, world creation, biomes, redstone, villagers, and animals may not work the same in current versions.
Full Version History – Snapshot Version History – Feature Requests and Suggestions
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Did some testing myself and I can confirm this issue. I have changed the examples a bit to make it easier to understand the actual problem, hope you are okay with that