#Make a function run only if a target is in the void

1 messages · Page 1 of 1 (latest)

paper ice
#

How do I do that?

full pivot
#

i think
execute as @a[y=-65,dy=-200] run function <your function>
or
execute if entity @a[y=-65,dy=-200] run function <your function>
the 1st one runs the function individually once for and as each player in the void
the 2nd one runs it just once per tick if there is a player in the void

#

you can make the dy lower i.e. -1000 if you really need the scanning area to be that far below bedrock

paper ice
#

cool, I'll try it out 😄

paper ice
#

in minecraft I mean

#

your code should work

full pivot
#

thats weird, it works in my testing world-

#

what version of minecraft are you using?

obtuse sundial
#

You could rip it apart, does the following work?

execute as @a at @s positioned ~ -65 ~ if entity @s[dy=-1000] run say in void
paper ice
#

no effect

#

I'm just using optifine, it shouldn't be a problem tho. I'm on 1.20

full pivot
#

ig you could copy y-positions of players in a scoreboard and test if the value is below -65

paper ice
#

😔

full pivot
#

you need help? haha

paper ice
#

bruh

#

it's working now

full pivot
#

oh- still weird that it didnt work with command blocks tho lol

paper ice
#

yeah. Basically what I'm trying to do is make all entities within a few x and z chunks of an end crystal teleport back to said crystal once being lower than y=0 in the end

#

it's not going well 😭

full pivot
#

ooooohhh in the end?

#

isnt the end's void still 0? i might be wrong

full pivot
fresh narwhal
#

Suggestion: when i normally do stuff like this I like working with scoreboards and just store their position, then execute based on the score and it has never failed me (there are definitely better ways of doing it, but i like scoreboards, and i know it works)

full pivot
fresh narwhal
full pivot
#

okay so is this solved?

fresh narwhal
#

@paper ice have you found a solution

full pivot
paper ice
vapid ginkgo
# paper ice The command was working, but I couldn't figure out how to make it work with my i...

Try to use this predicate :

[
  {
    "condition": "minecraft:location_check",
    "predicate": {
      "position": {
        "y": {
          "max": 0
        }
      }
    }
  },
  {
    "condition": "minecraft:inverted",
    "term": {
      "condition": "minecraft:location_check",
      "predicate": {
        "block": {}
      }
    }
  }
]

First part test if you are under y=0 and second part test if there is no block at your position. If both tests are true, then you are under the world

split wedge
#

resolved?

paper ice