#The Unless Command

1 messages · Page 1 of 1 (latest)

eternal radish
#

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 ~

plucky parcel
#

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 ...

eternal radish
#

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" } } }

plucky parcel
#

You can just pick whatever you prefer