Different repeating /tp behavior in Creative and Survival / Adventure modes via functions
The bug
Using the new 'function' feature of the 1.12 pre-releases, if you have a relative teleporting command continuously running via gameLoopFunction it can produce different results in Creative mode than it does in Survival or Adventure mode.
Having the function be called by a repeating command block works correctly.
How to reproduce
- Download the attached function swing.mcfunction
and place it in the following directory of your world folder
data/functions/custom
- Open the world
- Stand on a block higher than the blocks around you
- Use the following commands
/scoreboard objectives add swing dummy /scoreboard players set @s swing 0 /setblock ~10 ~-1 ~ sandstone /summon armor_stand ~5 ~3 ~ {NoGravity:1b,CustomName:"2"} - Set the function as gameLoopFunction
/gamerule gameLoopFunction custom:swing
- Switch to Survival mode
/gamemode survival
- Cast a fishing rod and try to hit the armor stand
→ You are teleported in a straight line - Reset the gameLoopFunction
/gamerule gameLoopFunction -
- Place a repeating command block with the following command and active it
function custom:swing
- Repeat steps 6 and 7
→ You properly "swing" now
Created Issue:
Different repeating /tp behavior in Creative and Survival/Adventure modes via functions
Using the new 'function' feature of the 1.12 pre-releases, if you have a relative teleporting command continously running via gameLoopFunction it produces different results in Creative mode than it does in Survival or Adventure modes.
Example: tp @p ~0.2 ~ ~ is running as a function.
When this command is running continously via gameLoopFunction:
1, In Creative mode, while the player is teleporting constantly in the positive X direction, he can still freely move the camera, move freely along the Z axis, and is affected normally by gravity (can jump and fall down)2, In Survival/Adventure modes, the player is locked in a straight line. While teleporting along the X axis, he cannot move around the Z axis, and is teleporting straight through the air even when there are no blocks below him, instead of falling down until he hits the ground. Turning around the camera is hard and shaky, too.
Expected behavior: player can retain control over movement / is affected by gravity in survival and adventure modes the same way as he does in creative mode.
P.S.: The same issue does NOT appear when using repeating command blocks.
Different repeating /tp behavior in Creative and Survival/Adventure modes via functionsDifferent repeating /tp behavior in Creative and Survival / Adventure modes via functions
Using the new 'function' feature of the 1.12 pre-releases, if you have a relative teleporting command continously running via gameLoopFunction it produces different results in Creative mode than it does in Survival or Adventure modes.
Example: tp @p ~0.2 ~ ~ is running as a function.
When this command is running continously via gameLoopFunction:
1, In Creative mode, while the player is teleporting constantly in the positive X direction, he can still freely move the camera, move freely along the Z axis, and is affected normally by gravity (can jump and fall down)2, In Survival/Adventure modes, the player is locked in a straight line. While teleporting along the X axis, he cannot move around the Z axis, and is teleporting straight through the air even when there are no blocks below him, instead of falling down until he hits the ground. Turning around the camera is hard and shaky, too.
Expected behavior: player can retain control over movement / is affected by gravity in survival and adventure modes the same way as he does in creative mode.
P.S.: The same issue does NOT appear when using repeating command blocks.
The bug
Using the new 'function' feature of the 1.12 pre-releases, if you have a relative teleporting command continously running via gameLoopFunction it can produce different results in Creative mode than it does in Survival or Adventure mode.
Having the function be called by a repeating command block works correctly.
How to reproduce
- Download the attached function swing.mcfunction
and place it in the following directory of your world folder
data/functions/custom- Open the world
- Stand on a block higher than the blocks around you
- Use the following commands
/scoreboard objectives add swing dummy /scoreboard players set @s swing 0 /setblock ~10 ~-1 ~ sandstone /summon armor_stand ~5 ~3 ~ {NoGravity:1b,CustomName:"2"}- Set the function as gameLoopFunction
/gamerule gameLoopFunction custom:swing- Switch to Survival mode
/gamemode survival- Cast a fishing rod and try to hit the armor stand
→ You are teleported in a straight line- Reset the gameLoopFunction
/gamerule gameLoopFunction -- Place a repeating command block with the following command and active it
function custom:swing- Repeat steps 6 and 7
→ You properly "swing" now
The bug
Using the new 'function' feature of the 1.12 pre-releases, if you have a relative teleporting command continuously running via gameLoopFunction it can produce different results in Creative mode than it does in Survival or Adventure mode.
Having the function be called by a repeating command block works correctly.
How to reproduce
- Download the attached function swing.mcfunction
and place it in the following directory of your world folder
data/functions/custom- Open the world
- Stand on a block higher than the blocks around you
- Use the following commands
/scoreboard objectives add swing dummy /scoreboard players set @s swing 0 /setblock ~10 ~-1 ~ sandstone /summon armor_stand ~5 ~3 ~ {NoGravity:1b,CustomName:"2"}- Set the function as gameLoopFunction
/gamerule gameLoopFunction custom:swing- Switch to Survival mode
/gamemode survival- Cast a fishing rod and try to hit the armor stand
→ You are teleported in a straight line- Reset the gameLoopFunction
/gamerule gameLoopFunction -- Place a repeating command block with the following command and active it
function custom:swing- Repeat steps 6 and 7
→ You properly "swing" now
Cannot confirm for example gravity works fine in Adventure mode when using the command you provided in a function set as gameLoopFunction
Sorry to bother you, this was my first post, and after testing using the method I mentioned, I couldn't recreate the problem myself either.
But thanks to you I now know that I should have been a bit more specific.
I'm trying to build a parkour map in vanilla Minecraft with a "few extra skills", one of them being able to swing across gaps using your fishing rod.
It works like this: when you cast the lure near and End rod (where there's actually an invisible armorstand floating custom named "2" or "4" [respectively for X and Z axis swinging]), your score in the "swing" dummy crietria gets updated, and as the score's ticking upwards, first you get teleported into position, then after falling briefly you start teleporting rapidly but relatively forward (this was the troublesome part) while also gaining a levitation effect.
This makes it look like you're actually swinging via the fishing rods rope.
I'm running these commands via a function, and when I do this, I get different results in Creative and Adventure mode.
Since you were so kind to help me out before, could I bother you a bit more? If you could, I will include the exact steps for reproducing my problem in my next reply. But if you don't want to, it's not that big of a tragedy.
Yes, feel free to include the exact steps. So did I understood you correctly that you are still seeing this problem but not with the provided command?
Yes, thank you very much, you are correct.
I'll provide now the whole scenario during which I ran into this peculiar presence.
1, Create a new world or load an existing one, and then, in the game's folder, saves>yourworld>data>functions create a map and in it a .mcfunction file. You can call them whatever you want, I called them "main" and "swing.mcfunction".
2, After that, copy and paste all the commands that I'll provide at the end of this message into that function file (sorry, I tried attaching the file itself, but it didn't work).
3, Then, while in game, add a dummy type scoreboard objective into the game, called swing, and also set your own score in to to 0.
/scoreboard objectives add swing dummy
/scoreboard players set @p swing 0
4, After reloading functions, if necessary ( /reload ), start running the function with gameLoopFunction.
/gamerule gameLoopFunction main:swing
5, Build a basic platform from which the "swinging" can take place.
{NoGravity:1,CustomName:"2"}Put at least one block which you can stand on 3 blocks above ground level. Then, in a horizontal direction, leaving a 9 block gap out, place another block.
In between these blocks, right in the middle, and another 3 blocks higher in the air, place an armor stand that is not affected by gravity, and which's custom name is either "2", if you want to swing along the X axis, or "4", if you want to swing along the Z axis.
/summon armor_stand ~ ~ ~
(In my map, they are invisible, and are placed right into End Rods. It gives the player the feeling they are swinging on the rods.)
6, Now just stand on either side of the swing on one of the blocks, hold a fishing rod in your hand, and cast the bobber so that it attaches itself to the armor stand (make sure you play the game in english language, because the bobber is only called "unknown" in the english version).
If you did everything right, during the next few seconds you should be "swinging through the gap" during a little command controlled sequence.
And my original 'bug' comes from the particular swinging animation not working properly outside Creative mode. In Creative, you swing across the gap with a little arc, first going slightly down and then back up, like I want it to happen. But in Adventure mode, as soon as you start "moving forward during the swing" (I made this happen via constant tp-ing) you start moving forward in a straight line, unaffected by gravity, instead of going in an arc.
I know it's a long list, I tried to be as precise as I could, but if you still miss something, let me now.
And now I'll copy-paste the commands here that you will have to copy-paste into the function file:
execute @e[name=unknown] ~ ~ ~ /execute @e[r=2,name=2] ~2 ~-4 ~-6 /execute @p[dx=5,dy=8,dz=12] ~ ~ ~ /scoreboard players set @p[score_swing=0] swing 1
execute @e[name=unknown] ~ ~ ~ /execute @e[r=2,name=2] ~-7 ~-4 ~-6 /execute @p[dx=5,dy=8,dz=12] ~ ~ ~ /scoreboard players set @p[score_swing=0] swing 41
execute @e[name=unknown] ~ ~ ~ /execute @e[r=2,name=4] ~-6 ~-4 ~-7 /execute @p[dx=12,dy=8,dz=5] ~ ~ ~ /scoreboard players set @p[score_swing=0] swing 81
execute @e[name=unknown] ~ ~ ~ /execute @e[r=2,name=4] ~-6 ~-4 ~2 /execute @p[dx=12,dy=8,dz=5] ~ ~ ~ /scoreboard players set @p[score_swing=0] swing 121
scoreboard players add @p[score_swing_min=1] swing 1
execute @e[name=unknown] ~ ~ ~ /execute @e[name=2,r=2] ~4 ~ ~ /teleport @p[score_swing_min=2,score_swing=2] ~ ~ ~ ~ ~
effect @p[score_swing_min=10,score_swing=11] levitation 1 6 true
tp @p[score_swing_min=10,score_swing=30] ~-0.46 ~ ~
execute @p[score_swing_min=32,score_swing=33] ~ ~ ~ /kill @e[name=unknown]
scoreboard players set @p[score_swing_min=34,score_swing=36] swing 0
execute @e[name=unknown] ~ ~ ~ /execute @e[name=2,r=2] ~-4 ~ ~ /teleport @p[score_swing_min=42,score_swing=42] ~ ~ ~ ~ ~
effect @p[score_swing_min=50,score_swing=51] levitation 1 6 true
tp @p[score_swing_min=50,score_swing=70] ~0.46 ~ ~
execute @p[score_swing_min=72,score_swing=73] ~ ~ ~ /kill @e[name=unknown]
scoreboard players set @p[score_swing_min=74,score_swing=76] swing 0
execute @e[name=unknown] ~ ~ ~ /execute @e[name=4,r=2] ~ ~ ~-4 /teleport @p[score_swing_min=82,score_swing=82] ~ ~ ~ ~ ~
effect @p[score_swing_min=90,score_swing=91] levitation 1 6 true
tp @p[score_swing_min=90,score_swing=110] ~ ~ ~0.46
execute @p[score_swing_min=112,score_swing=113] ~ ~ ~ /kill @e[name=unknown]
scoreboard players set @p[score_swing_min=114,score_swing=116] swing 0
execute @e[name=unknown] ~ ~ ~ /execute @e[name=4,r=2] ~ ~ ~4 /teleport @p[score_swing_min=122,score_swing=122] ~ ~ ~ ~ ~
effect @p[score_swing_min=130,score_swing=131] levitation 1 6 true
tp @p[score_swing_min=130,score_swing=150] ~ ~ ~-0.46
execute @p[score_swing_min=152,score_swing=153] ~ ~ ~ /kill @e[name=unknown]
scoreboard players set @p[score_swing_min=154,score_swing=156] swing 0
Thank you for the reproduction steps, I was able to reproduce this bug now. Could be caused by
MC-117360.So you think that the probem is caused by functions having a slightly different behavior than command blocks do, and that combining the two methods together might solve it.
Even though I wanted to completely exclude command blocks from my map, since they have to be in loaded chuncks to work and in great numbers they can make the game more laggy, maybe they could still work. Since these "swinging points" will be usable only in specific places anyways, unlike some other futures, like double jumping and wall jumping, maybe moving the 'tp' part from the function into a nearby repeating command block could really solve the problem without causing further trouble.
Thank you for the tip, and also for taking the time to help me out. I'll try out this new method soon. Hope it'll work.
No problem. The report will be likely reopened soon, I cannot do that as helper but the mods are informed. And a small tip for your map: Consider using a tag instead of the name when identifying the armor stand since renamed armor stands have their name applied to them when placed since some versions ago and otherwise players might be able to exploit that in your map.
Is this still an issue in the most recent versions (currently that is 1.13.2, or the latest snapshot 18w49a) of Minecraft? If so, please update the affected versions and help us keeping this ticket updated from time to time. If you are the owner/reporter of this ticket, you can modify the affected version(s) yourself.