Hello everyone! I am currently in 1.21 and i am trying to detect if a armorstand is at certain coordinates, and if it isnt, for it to continuously teleport downwards until it reaches it. I tried the command using unless but it doesnt seem to work. Do you know any good workarounds if its not possible? heres the command /execute unless entity @e[tag=RotorDrop,type=minecraft:armor_stand,x=0,y=115,z=0,distance=0.1] as @e[tag=RotorDrop] at @s run tp @s ~ ~.01 ~
#The Unless Command
1 messages · Page 1 of 1 (latest)
Well firstly, you're probably never going to want to use distance=value since that will only succeed if the entity is exactly that distance away. You'll generally use sth like distance=..max, distance=min.. or distance=min..max.
Secondly, if you want to check the y level of an entity your best bet is to use predicates. You can inline these though, e.g. execute if predicate {condition:"minecraft:entity_properties",entity:"this",predicate:{location:{position:{y:{min:0,max:10}}}}} run ...
wouldnt you have to make the predicate using a datapack and call it?
cause ive never seen a command that involved before
like heres the predicate { "condition": "minecraft:entity_properties", "entity": "this", "predicate": { "location": { "position": { "y": { "min": 113, "max": 115 } }, "dimension": "tardis_dimension:tardis_dimension" } } }
You can do that if you want, then you'd do if predicate namespace:path. "inlining" a predicate means that instead of writing it in a separate file you write the whole thing in the same line of text as the command, and then you don't need a datapack
You can just pick whatever you prefer