| 1 |
---input--- |
| 2 |
execute |
| 3 |
as @a # For each "player", |
| 4 |
at @s # start at their feet. |
| 5 |
anchored eyes # Looking through their eyes, |
| 6 |
facing 0 0 0 # face perfectly at the target |
| 7 |
anchored feet # (go back to the feet) |
| 8 |
positioned ^ ^ ^1 # and move one block forward. |
| 9 |
rotated as @s # Face the direction the player |
| 10 |
# is actually facing, |
| 11 |
positioned ^ ^ ^-1 # and move one block back. |
| 12 |
if entity @s[distance=..0.6] # Check if we're close to the |
| 13 |
# player's feet. |
| 14 |
run |
| 15 |
say "I'm facing the target!" |
| 16 |
|
| 17 |
---tokens--- |
| 18 |
'execute' Name.Builtin |
| 19 |
'\n ' Text.Whitespace |
| 20 |
'as' Keyword.Constant |
| 21 |
' ' Text.Whitespace |
| 22 |
'@a' Name.Variable |
| 23 |
' ' Text.Whitespace |
| 24 |
'# For each "player",' Comment.Single |
| 25 |
'\n ' Text.Whitespace |
| 26 |
'at' Keyword.Constant |
| 27 |
' ' Text.Whitespace |
| 28 |
'@s' Name.Variable |
| 29 |
' ' Text.Whitespace |
| 30 |
'# start at their feet.' Comment.Single |
| 31 |
'\n ' Text.Whitespace |
| 32 |
'anchored' Keyword.Constant |
| 33 |
' ' Text.Whitespace |
| 34 |
'eyes' Keyword.Constant |
| 35 |
' ' Text.Whitespace |
| 36 |
'# Looking through their eyes,' Comment.Single |
| 37 |
'\n ' Text.Whitespace |
| 38 |
'facing' Keyword.Constant |
| 39 |
' ' Text.Whitespace |
| 40 |
'0' Literal.Number.Float |
| 41 |
' ' Text.Whitespace |
| 42 |
'0' Literal.Number.Float |
| 43 |
' ' Text.Whitespace |
| 44 |
'0' Literal.Number.Float |
| 45 |
' ' Text.Whitespace |
| 46 |
'# face perfectly at the target' Comment.Single |
| 47 |
'\n ' Text.Whitespace |
| 48 |
'anchored' Keyword.Constant |
| 49 |
' ' Text.Whitespace |
| 50 |
'feet' Keyword.Constant |
| 51 |
' ' Text.Whitespace |
| 52 |
'# (go back to the feet)' Comment.Single |
| 53 |
'\n ' Text.Whitespace |
| 54 |
'positioned' Keyword.Constant |
| 55 |
' ' Text.Whitespace |
| 56 |
'^' Operator |
| 57 |
' ' Text.Whitespace |
| 58 |
'^' Operator |
| 59 |
' ' Text.Whitespace |
| 60 |
'^' Operator |
| 61 |
'1' Literal.Number.Float |
| 62 |
' ' Text.Whitespace |
| 63 |
'# and move one block forward.' Comment.Single |
| 64 |
'\n ' Text.Whitespace |
| 65 |
'rotated' Keyword.Constant |
| 66 |
' ' Text.Whitespace |
| 67 |
'as' Keyword.Constant |
| 68 |
' ' Text.Whitespace |
| 69 |
'@s' Name.Variable |
| 70 |
' ' Text.Whitespace |
| 71 |
'# Face the direction the player' Comment.Single |
| 72 |
'\n ' Text.Whitespace |
| 73 |
'# is actually facing,' Comment.Single |
| 74 |
'\n ' Text.Whitespace |
| 75 |
'positioned' Keyword.Constant |
| 76 |
' ' Text.Whitespace |
| 77 |
'^' Operator |
| 78 |
' ' Text.Whitespace |
| 79 |
'^' Operator |
| 80 |
' ' Text.Whitespace |
| 81 |
'^' Operator |
| 82 |
'-1' Literal.Number.Float |
| 83 |
' ' Text.Whitespace |
| 84 |
'# and move one block back.' Comment.Single |
| 85 |
'\n ' Text.Whitespace |
| 86 |
'if' Keyword.Constant |
| 87 |
' ' Text.Whitespace |
| 88 |
'entity' Keyword.Constant |
| 89 |
' ' Text.Whitespace |
| 90 |
'@s' Name.Variable |
| 91 |
'[' Punctuation |
| 92 |
'distance' Name.Attribute |
| 93 |
'=' Punctuation |
| 94 |
'..' Literal |
| 95 |
'0.6' Literal.Number.Float |
| 96 |
']' Punctuation |
| 97 |
' ' Text.Whitespace |
| 98 |
"# Check if we're close to the" Comment.Single |
| 99 |
'\n ' Text.Whitespace |
| 100 |
"# player's feet." Comment.Single |
| 101 |
'\n ' Text.Whitespace |
| 102 |
'run' Keyword.Constant |
| 103 |
' \n say' Name.Builtin |
| 104 |
' ' Text.Whitespace |
| 105 |
'"' Literal.String.Double |
| 106 |
"I'm facing the target!" Literal.String.Double |
| 107 |
'"' Literal.String.Double |
| 108 |
'\n' Text.Whitespace |