By default, any executed command will be executed at the position of the entity/block which ran that command (unless you specify a new execution point). Since you ran the command yourself, the armor stand will summon that item at your position. To change the execution point, use the "at" statement.
example:
/execute as @e[type=minecraft:armor_stand,distance=..20,tag=Labyrinth] at @s run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:golden_apple",Count:1}}
notice how I used "at @s" to move the execution point to the armor stand itself
@s simply means "this" entity (the entity which is running this command and is specified by "as")
notice how I used "at @s" to move the execution point to the armor stand itself
In my particular case, is there any difference in using `execute as ... at @s` (command 1 below) instead of the simpler `execute at ...` (command 2 below)? Or is this simply a good habit?
-1-
/execute as @e[type=minecraft:armor_stand,distance=..20,tag=Labyrinth] at @s run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:golden_apple",Count:1}}
-2-
/execute at @e[type=minecraft:armor_stand,distance=..20,tag=Labyrinth] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:golden_apple",Count:1},Tags:["Labyrinth"]}
Rollback Post to RevisionRollBack
Please, support the sledgehammer tool!
I ♥ Linux. Thanks Mojang for providing a game that runs natively on that OS!
In my particular case, is there any difference in using `execute as ... at @s` (command 1 below) instead of the simpler `execute at ...` (command 2 below)? Or is this simply a good habit?
-1-
/execute as @e[type=minecraft:armor_stand,distance=..20,tag=Labyrinth] at @s run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:golden_apple",Count:1}}
-2-
/execute at @e[type=minecraft:armor_stand,distance=..20,tag=Labyrinth] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:golden_apple",Count:1},Tags:["Labyrinth"]}
I like to use "as ... at @s" because that gives me a reference to that entity if I need it later on in the command but you can use "execute at ..." in this example because you only need to get the position of the armor stand and not the armor stand itself. It's mostly a matter of personal preference.
I try to summon items at location identified by invisible armor stands:
However the items all spawn at the player location. Not at the armor stand location. What am I doing wrong here?
Please, support the sledgehammer tool!
I ♥ Linux. Thanks Mojang for providing a game that runs natively on that OS!
By default, any executed command will be executed at the position of the entity/block which ran that command (unless you specify a new execution point). Since you ran the command yourself, the armor stand will summon that item at your position. To change the execution point, use the "at" statement.
example:
notice how I used "at @s" to move the execution point to the armor stand itself
@s simply means "this" entity (the entity which is running this command and is specified by "as")
Command block engineer // Developer // #TeamTrees
`at` not `as`. That was so simple!
In my particular case, is there any difference in using `execute as ... at @s` (command 1 below) instead of the simpler `execute at ...` (command 2 below)? Or is this simply a good habit?
Please, support the sledgehammer tool!
I ♥ Linux. Thanks Mojang for providing a game that runs natively on that OS!
I like to use "as ... at @s" because that gives me a reference to that entity if I need it later on in the command but you can use "execute at ..." in this example because you only need to get the position of the armor stand and not the armor stand itself. It's mostly a matter of personal preference.
Command block engineer // Developer // #TeamTrees