4

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?

  • 2
    Does execute @e[type=arrow] ~ ~ ~ teleport @e[type=pig] ~ ~2 ~ work? Specifically "teleport" instead of "tp" and leave out the second command. If that doesn't work, would it be an option to have the mob be higher above the arrow? – Fabian Röling Dec 12 '17 at 21:00
  • 2
    Also, I don't now how well /entitydata works with changing passengers, but if it works properly, you could try adding the plug to the arrow as a passenger. I can't try this myself until Friday. – Fabian Röling Dec 12 '17 at 21:02
  • Well... the order of your commands doesn't make sense. The first one does nothing, because the second set of coordinates apparently is centered on the pig, not the executing arrow. (/teleport IIRC is centered on executing entity, so it may work.) You second command obviously hurts the pig, because you teleport it exactly to where the arrow is at. If you just switch the commands around it should work, as the pig will be teleported to the arrow and immediately teleported 2 blocks upwards before it can be hit by the arrow. – RimaNari Dec 16 '17 at 16:02
5

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"}]}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.