2

Does anyone know how to make straight flying arrows using command blocks? I'm trying to make an easier way of teleporting than ender pearls, which do damage and don't fly straight. I've made the following commands;

/scoreboard objectives add Shot stat.useItem.minecraft.bow
/scoreboard objectives add Holding dummy
/scoreboard objectives add Arrow dummy
/scoreboard objectives add InGround dummy

/scoreboard players set @a Holding 0
/scoreboard players set @a Holding 1 {SelectedItem:{tag:{display:{Name:"Enterprise"}}}}
/execute @a[score_Shot_min=1,score_Holding_min=1] ~ ~ ~ /scoreboard players set @e[type=Arrow,r=2] Arrow 1
/scoreboard players set @e[type=Arrow,score_Arrow_min=1] InGround 1 {inGround:1b}
/execute @e[type=Arrow,score_InGround_min=1] ~ ~ ~ /tp @p[score_Holding_min=1] @e[score_InGround_min=1]
/kill @e[type=Arrow,score_InGround_min=1]
/scoreboard players set @a Shot 0

There's only one problem: arrows don't fly straight either. Does anyone know how to make them fly straight?

2
  • 4
    Do you need arrows specifically to fly straight, or would another projectile be fine for your purpose?
    – SirBenet
    Commented Dec 19, 2015 at 18:01
  • As long as it's easy to get in survival. Commented Dec 20, 2015 at 15:08

3 Answers 3

1

You can't make arrows fly straight with just commands. You seem good enough with commands, so Ill just give you the basic idea.
change any arrow you shoot with the entity of a fireball. You could potentially make it an arrow riding an invisible fireball, but Im not sure how well that would work. You can't easily tell an arrow to face what direction you shot it in, so the arrow would simply be flying forward on an invisible fireball facing downward. There is no way to make an arrow fly straight without using that method. It doesn't look good, and I would recommend trying some different idea altogether than making arrows fly straight. You could tell the arrow to face a certain direction by sensing your direction and facing in that direction. There are endless possible directions you could be facing, and to even get a rough approximation of the arrow facing the direction you want you would need hundreds, if not thousands of command blocks.

4

The Minecraft 1.10 update introduced the "No Gravity" {NoGravity:1} tag. You can use that to make hoverboats, straight arrows, snowballs, etc.

1
  • Yes, a loop command block with the command "/entitydata @e[type=Arrow] {NoGravity:1b}" will solve your problems Commented Nov 30, 2016 at 4:52
1

There is a way now of 1.9(1.9 snapshots):

The stuff in this video is very complex, so im giving just a quick overview here(for more information see the box below)

The "engine", developed only with commandblocks, features custom weapons and special projectiles for every weapon, using physics engine. At about 13:00, he shows the commands, which are executed, when a projectile hits an entity or block. This is where you put your teleportation command. Because the engine tracks, which player fired which projectile, this would even work with multiple players.

This would require a lot of work, but its not very much compared to the complexity of the engine itself.


More in-depth overview, of what the video shows:

The youtuber GamerGuppy developed a physics engine within vanilla Minecraft(1.9 snapshots) using commandblocks, in order to add custom weapons and custom projectiles to the game. This engine works with a method, called raytracing, to calculate the next position of a projectile and if it hit a wall or an entity. The "engine" features an easy way, to execute commands, when a projectile hits a wall or an entity(used for sound/particle effects). You can use this section, to execute your teleportation command(s).

A view on the contraption, to give a reference for the size

2
  • Even though it is complex, we require answers to include what the link mentions, can you explain it shortly (if you want with pictures too)?
    – ave
    Commented Jan 5, 2016 at 23:27
  • @ardaozkal I think, thats enough information.
    – Mystery
    Commented Jan 5, 2016 at 23:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .