1

Im making a Snake Game using Armor Stands on the positions of table game and for the body of the snake. I want to check when the the Armor Stand {Tags:["head"]} of the snake has the same position of an Armor Stand {Tags:["food"]} of a food. (1.16 Version)

enter image description here

(The others Armor Stands are invisible)

2

I already know two ways to do that.

1. Testfor:

The testfor of 1.12 can be rewrited as, for 1.16:

execute at @e[tag=food] if @e[tag=head,distance=..0.5] run tellraw @a "Same Position Check"

2. Execute Store:

execute store result score @e[tag=head] X run data get entity @e[tag=head] Pos[0]; for X coordinate

execute store result score @e[tag=head] Y run data get entity @e[tag=head] Pos[1]; for Y coordinate

execute store result score @e[tag=head] Z run data get entity @e[tag=head] Pos[2]; for Z coordinate

execute store result score @e[tag=food] X run data get entity @e[tag=food] Pos[0]; for X coordinate

execute store result score @e[tag=food] Y run data get entity @e[tag=food] Pos[1]; for Y coordinate

execute store result score @e[tag=food] Z run data get entity @e[tag=food] Pos[2]; for Z coordinate

And then, test the scoreboards scores of the coordinates X,Y and Z:

execute if score @e[tag=head] X = @e[tag=food] X if score @e[tag=head] Y = @e[tag=food] Y if score @e[tag=head] Z = @e[tag=food] Z run tellraw @a "Same Position Check"
| improve this answer | |
1

How

Check if the other armor stand is within distance 0.5.

Selector

@e[name=“Example”,distance=..0.5]

Testfor

1.13+

/execute if @e[name=“Example”,distance=..0.5]

1.12-

/testfor @e[name=“Example”,distance=..0.5]
| improve this answer | |
  • If anyone knows then could they add a 1.13+ i didn't know selectors even changed in 1.13 – Penguin Oct 19 at 1:38

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.