How to make a mob ride an arrow?
I am trying to make a command in Minecraft 1.12.1 where a pig can ride an arrow, but I keep running into problems.
The first problem is, that when a mob is riding an arrow, it gets damaged and causes the arrow to stop moving.
I want to make the arrow continue moving without hurting the mob.
The commands I am using (in a repeating command block) are as follows:
/execute @e[type=arrow] ~ ~ ~ tp @e[type=pig] ~ ~2 ~
And the problem with that command is that the pig is only constantly being teleported up 2 blocks from where it was as long as the arrow exists.
The second command is:
/tp @e[type=pig] @e[type=arrow]
And the problem is basically the pig is damaged and the arrow doesn't go anywhere.
I've tried them both together and separately but they just won't work. Any ideas?
Solution 1:
The first thing I thought of was to use the /summon
command.
There is a parameter in the data tag that allows you to add passengers to an entity, so if you summon an arrow with a pig riding it, it won't be harmed. If you change the Motion tag, you can make the arrow go in a specific direction. The full command is as follows:
/summon arrow ~ ~ ~ {Motion:[0.0,0.0,0.0],Passengers:[{id:"minecraft:pig"}]}
Another approach to this also uses the data tag but it can be performed on an arrow fired from a dispenser for example. This would be executed like this:
/entitydata @e[type=arrow] {Passengers:[{id:"minecraft:pig"}]}