0

I'm trying to make a datapack and a I have a function and when I call it normally within code or Minecraft it works fine and if I run the command execute as @e[tag=robot] if block ~ ~-1 ~ air run function robot:simulate_gravity in the code it doesn't work but inside Minecraft when I call it from the chat it does work.

Any ideas why?

1 Answer 1

1

If the function works, you must have an error with this part:

execute as @e[tag=robot] if block ~ ~-1 ~ air run

A multitude of problems could be causing this. In addition to the obvious (make sure there is an entity tagged robot, make sure the block under the robot is air, etc.), the most likely issue is that the function is not being ran at the robot. Instead, the if block ~ ~-1 ~ air check is run at the location the command was executed (at your player, or at a command block, whichever you are using).

1
  • Thank you very much! I forgot about that Commented Sep 26, 2021 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.