Is there a way to apply a command to mobs that meet certain standards? For example, I'm pretty sure there's no way to rotate a spider sideways, but if there was...
If the block below the spider is air, continue. If not, ignore the rest of the code
if the block x+1 is air, continue. If not, rotate the spider so that the bottom of the mob is facing the block
if the block x-1 is air, continue. If not, rotate the spider... etc.
if the block z+1... etc.
this would make a spider "climb" a wall (if it were possible to rotate spiders)
Is there a way to apply the command (in this example, rotate) to only the spiders that meet the specific criteria? I don't want every spider in the world to rotate the same direction simultaneously.
basically it's an if statement:
if y-1 =/= air: stop
if x-1 =/= air...
you could use the execute command for this.
execute <entity> <x> <y> <z> detect <x2> <y2> <z2> <block> <data> <command …>
if an air block is one block under a spider it will run whatever command is.
execute @e[type=spider] ~ ~ ~ detect ~ ~-1 ~ minecraft:air 0 command
hope this helps,
i think this should help, so thank you. Is there a way to run a command if at any point the 'detect' command is false? Referencing the previously mentioned if-statement, the Else part.
if the spider is climbing x+1, I would want to stop at the "HERE" in the following command and switch to a different command
execute @e[type=Spider] ~ ~ ~ detect ~ ~-1 ~ air 0 execute @e[type=Spider] ~ ~ ~ detect ~1 ~ ~ air 0 HERE execute @e[type=Spider] ~ ~ ~ detect ~ ~ ~1...
at HERE: rotate spider or (tp ~ ~-500 ~) it and summon a rotated one
thank you again