Commandblock help needed!

Such an intricate part of Minecraft that it deserves a whole section dedicated to it. Post your most amazing Redstone creations here!

Post Permalink
by Dark_Alpha_ » 4/21/2017

Is there a way to rotate a players head so it will face it's nearest entity?
Image
gues what's my favorite game :D
User avatar
Level 22
Expert Pig
Posts: 198
Joined: 7/24/14

Post Permalink
by Pepijn » 4/21/2017

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.
Image
User avatar
Contest Judge
Level 51
Grandmaster Cyborg
Posts: 1156
Joined: 12/9/13
Location: The Netherlands
Minecraft: Pepijn

Post Permalink
by Bertiecrafter » 4/21/2017

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.
Image
Image
User avatar
Level 22
Expert Engineer
Posts: 412
Joined: 2/15/15
Says: gibi.minecraftr.us
Minecraft: Bertiecrafter
mc_server: GIBI - Gather It, Build It

Post Permalink
by Jamzs3 » 4/21/2017

https://mcstacker.bimbimma.com/
Code: Select all
 /summon armor_stand ~ ~1 ~ {Rotation:[1f,0.0f]}


It is somewhat possible, using armor stands.
I make modded/vanilla maps.
Image
Image
User avatar
Level 28
Expert Demolitionist
Posts: 143
Joined: 9/19/12
Location: Australia! G'day Mate
Says: Addicted to Armored Warfare. Send help...
Minecraft: Jamzs3
mc_server: Lol NOPE

Post Permalink
by Pepijn » 4/22/2017

Bertiecrafter wrote: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.


This could work, although Zombie rotation has always been iffy from my experience.
Image
User avatar
Contest Judge
Level 51
Grandmaster Cyborg
Posts: 1156
Joined: 12/9/13
Location: The Netherlands
Minecraft: Pepijn


Return to Redstone