0

I need the player always to be facing a certain direction but I can't use a repeating command block to teleport you to the same place every tick. I tried this command: execute unless entity @a[x_rotation=-179.0,y_rotation=0.9] but even when your x and y rotation is -180.0 and 0.9 is still runs the command. Why is this?

Thanks, Dream

3
  • I'm not an expert, but if @a checks all entities, wouldn't it mean that all entities (all players, enemies, some blocks even) have to be facing that direction? And if they don't, it executes – Elise Jul 24 '18 at 11:14
  • I just had a check and here: gist.github.com/Dinnerbone/3736487 , it says: "@a a list of all players". I don't think it has anything to do with entites. If @a targeted entities as well, when I run a tp command, all entites should teleport but they dont. – DreamingInsanity Jul 24 '18 at 11:28
  • Is there more than one player that can be targeted right now? (i.e. are there other players on the server?) execute unless will only run the chained command if the result of the test (in this case, the number of entities found) returns exactly 0. It would help a bit if you also included which command you wanted to run with this execute. – MBraedley Jul 24 '18 at 15:06
1

I figured it out. It turns out that that it should be: execute unless entity @a[x_rotation=0.9,y_rotation=-179.0] since the x and y are flipped compared to the co-ords. It should also be something like: execute unless entity @a[x_rotation=-0.5..0.9,y_rotation=175.0..181.0] so it targets players between certain values rather than specific ones. If you imagine something rotating on the y-axis it would be theoretically be spinning left to right or right to left and on the x-axis it would be spinning up and down.

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.