1

Commandblock help needed!

Dark_Alpha_'s Avatar Dark_Alpha_4/21/17 7:07 am
1 emeralds 478 4
4/22/2017 1:24 am
Pepijn's Avatar Pepijn
Is there a way to rotate a players head so it will face it's nearest entity?
Posted by Dark_Alpha_'s Avatar
Dark_Alpha_
Level 28 : Expert Pig
22

Create an account or sign in to comment.

4

1
04/21/2017 11:39 pm
Level 5 : Apprentice Miner
anonpmc792389
anonpmc792389's Avatar
[deleted]
1
04/21/2017 11:42 am
Level 70 : Legendary Engineer
Bertiecrafter
Bertiecrafter's Avatar
Eeehhh...
All I can think of is using another entity with slowness and invisibility to look at it's enemy.
E.g: have an zombie look at a villager that you want to track, an iron golem for hostile mobs or a guardian for squids (I think?).
And then use /tp @p @e[type=<mob>,name=<name>] to tp the player to this invisible mob that looks at another mob that you want to track. The /tp command takes rotation into account.
1
04/22/2017 1:24 am
Level 57 : Grandmaster Cyborg
Pepijn
Pepijn's Avatar
This could work, although Zombie rotation has always been iffy from my experience.
1
04/21/2017 8:00 am
Level 57 : Grandmaster Cyborg
Pepijn
Pepijn's Avatar
Not really. You would have to measure the x, y and z distance between the player and the nearest entity (using iterations of moving armorstands or something) and then apply some geometry calculations to get the proper rotation. But you won't be done yet, because there's no way to automatically put those rotations in a tp command, so you would have to set the player at rotation 0 0 and then iterate through the rotations, subtracting form them till you reach 0.

tl;dr
Lot of work, works pretty slow, inaccurate. It's probably not worth it.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome