I'm making a little chess game in Minecraft with commands and need a cursor for the player to select one of their own pieces by looking at it. I thought I had figured a way to do it with area_effect_clouds that will be teleported a small distance (0.08 blocks) each tick from anyone who has the tag "PlayingChess" (with I have ensured with other commands that they always have as they are playing chess). The problem is that the area effect clouds don't seem to be teleporting at all and here are the commands (in the same order as they are placed in a chain):
/execute at @a[tag=PlayingChess,scores={ChessSneak=1..}] positioned ~ ~1.2 ~ run summon minecraft:area_effect_cloud ^ ^ ^0.08 {Duration:12,Tags:["Undirected"],CustomName:"{\"text\":\"ChessTargeting\"}"}
/execute as @e[type=minecraft:area_effect_cloud,name=ChessTargeting] at @s run teleport @s ~ ~ ~ facing entity @a[tag=PlayingChess,sort=nearest,limit=1] eyes
/tag @e remove Undirected
/execute as @e[type=minecraft:area_effect_cloud,name=ChessTargeting] at @s run teleport @s ^ ^ ^-0.08
/execute at @e[type=minecraft:area_effect_cloud,name=ChessTargeting] if block ~ ~ ~ minecraft:quartz_pillar at @e[name=WhitePiece,distance=..0.1,sort=nearest,limit=1] run summon minecraft:area_effect_cloud ~ ~ ~ {Duration:20,CustomName:"{\"text\":\"ChessSelect\"}"}
/execute as @e[type=minecraft:area_effect_cloud,name=ChessTargeting] at @s if block ~ ~ ~ minecraft:quartz_pillar run kill @s
When the cursor area effect cloud hits a quarts pillar block (the chess table) it should spawn a new area effect cloud at the nearest white chess piece (area effect cloud with name "WhitePiece") and then die.
I have this to display to the player which piece is selected:
/execute at @e[type=minecraft:area_effect_cloud,name=ChessSelect] run summon minecraft:falling_block ~ ~0.02 ~ {BlockState:{Name:"minecraft:lime_stained_glass_pane"},NoGravity:1b,Time:0,DropItem:0b}
I have done a lot of testing and it seems the problem is with teleporting the area effect cloud forward using:
/execute as @e[type=minecraft:area_effect_cloud,name=ChessTargeting] at @s run teleport @s ^ ^ ^-0.08
or making it face the player from the beginning with:
/execute as @e[type=minecraft:area_effect_cloud,name=ChessTargeting] at @s run teleport @s ~ ~ ~ facing entity @a[tag=PlayingChess,sort=nearest,limit=1] eyes
Thankful for all replies!! :)