3

I'd like to be able to attach a leadable mob (like a pig or a cow) to a passive mob or monster so that I can make the illusion that it is on the end of the lead. No, /ride is not the solution because I want to be able to position the lead anywhere on the mob, not just above it. What I tried was making a repeating command block run this command:

/execute at @n[type=enderman] run teleport @n[type=pig] ~ ~1 ~

However, the mob boxes of the pig and the enderman would conflict, and the pig would push the enderman around even while it was not actually moving. This causes the enderman to walk slowly in random directions instead of stand still (the pig is invisible in this GIF):

Enderman walking backwards


Is there a way to make a passive mob look like it is on a lead without pushing it around in random directions?

A bonus that isn't required but would be really cool would be if the passive mob could actually be pulled around with the lead, instead of just looking like it is being pulled around.

1 Answer 1

3

Sounds like a job for the /team command once again. Teams have a bunch of useful features including push by collisions.

You only need to run these commands once:

team add no_push
team modify no_push collisionRule never
team join no_push <target passive mob>

Any entity in this team, in particular the passive mob of interest, can never be pushed by anything else. However, it will still interact with leads, which is exactly what is wanted.

Team options have a bunch of useful lesser known features, so I highly recommend looking at the /team wiki page

You should also consider teleporting the enderman to the passive mob instead of the other way around, that way it will give you more control over the lead

1
  • 1
    Thank you for the wiki link, that will definitely come in handy! Commented 7 hours ago

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.