I read some solutions on the forum at the request of "teleport arrow". It seems like I haven't found the answer to the question I need. If there has already been a similar response, then I apologize.
In general at the moment I have an implementation of a "teleporting arrow" that works using ender pearl. For those who may be interested in the implementation, I am attaching the code below with a description of the functions.
The arrow itself, both in the form of the arrow-entity and in the form of the item-entity, has {data: {arrow_type: "teleport"}}.
Setting the parameters of the launched arrow at HasBeenShot: 0b. The arrow is adjusted so that it can fly through entities without causing damage to them and also so that it cannot be picked up:
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},HasBeenShot:0b}] at @s run data modify entity @s PierceLevel set value 10b
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},HasBeenShot:0b}] at @s run data modify entity @s crit set value 0b
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},HasBeenShot:0b}] at @s run data modify entity @s damage set value 0.0d
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},HasBeenShot:0b}] at @s run data modify entity @s pickup set value 0b
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},HasBeenShot:0b}] at @s run summon minecraft:interaction ~ ~ ~ {Tags:["teleport_arrow_support_interaction"]}
The "interaction" entity is created to save the current value of Motion: [x, y, z] of the arrow (which will be implemented in subsequent commands), so that after the arrow lands, this value of Motion: [x, y, z] can be transferred to ender pearl. This is done because if you don't set ender pearl Motion: [x, y, z] like in arrow, then when the arrow collides with a wall or ceiling, ender pearl will just start falling down, rather than teleporting into that wall or ceiling itself. At the same time the landed arrow has Motion: [0.0d, 0.0d, 0.0d] as a result of which we cannot directly get these values from it for transmission to ender pearl.
Setting the parameters of the flying arrow, i.e. with HasBeenShot: 1b & inGround: 0b:
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},HasBeenShot:1b,inGround:0b}] at @s run teleport @n[tag=teleport_arrow_support_interaction] @s
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},HasBeenShot:1b,inGround:0b}] at @s run data modify entity @n[tag=teleport_arrow_support_interaction] Motion set from entity @s Motion
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},HasBeenShot:1b,inGround:0b}] at @s run particle minecraft:dust{color:[1, 0, 1], scale:2} ~ ~ ~ 0.1 0.1 0.1 1 2 force
As you can see the interaction entity teleports to a flying arrow so that it works correctly with more than one arrow in the world. Particles are also created around the flying arrow.
Setting the parameters of the landed arrow, i.e. with inGround: 1b:
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},inGround:1b}] at @s run summon minecraft:item ~ ~ ~ {Item: {id: "minecraft:arrow", count: 1}}
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},inGround:1b}] at @s run summon minecraft:ender_pearl ~ ~ ~ {Tags:["teleport_arrow_support_pearl"]}
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},inGround:1b}] at @s run data modify entity @n[type=minecraft:ender_pearl,tag=teleport_arrow_support_pearl] Owner set from entity @s Owner
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},inGround:1b}] at @s run data modify entity @n[type=minecraft:ender_pearl,tag=teleport_arrow_support_pearl] Motion set from entity @n[type=minecraft:interaction,tag=teleport_arrow_support_interaction] Motion
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},inGround:1b}] at @s run kill @n[type=minecraft:interaction,tag=teleport_arrow_support_interaction]
execute as @e[type=minecraft:arrow,nbt={data:{arrow_type:"teleport"},inGround:1b}] at @s run kill @s
An arrow-item is created near the landed arrow (this function is aimed at survival mode), an ender pearl is also created, to which the parameter Owner: [] is passed from the arrow (so that the player who launched the arrow teleports) and the parameter Motion: [] from the interaction entity, as I described earlier. After that, the arrow itself and the interaction are removed.
Actually all this works fine but in my opinion this approach is not ideal because of these problems:
- Receiving damage on landing
- The chance of the appearance of endermite
I would like to try to implement this functionality using the /teleport command to teleport a player to a landed arrow without an intermediary in the form of ender pearl. Basically I need to somehow take the Owner: [] parameter from the arrow and teleport a player (or even a mob) that has an identical UUID: []. But I have no idea how to do it. Perhaps using scoreboards it is possible to implement this, but I still don't understand them well enough, that's why I'm asking for help. Thanks!