how to make AI condition happen every few ticks?

Started by aqology on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how to make AI condition happen every few ticks?
Mon, 02/24/2025 - 06:00 (edited)

hi, i've been trying to make a mod of birds, where they randomly walk and fly.

i've gotten the ai to work, where they will switch between walking and flying, but i'm encountering a problem. the entity walks for about 2 ticks, and then instantly starts flying again. it flies immediately upon spawning, and the only way i can get it to walk is (slowly) lowering it with a lead until it touches the ground. how do i set it so that an entity will only fly every 20 ticks or so? 

i'm sure there's a procedure for it, i assume the "Wait _ ticks then do-" but i can't get that to work either. i'm just so confused. 

 

(edit: is there also a way to make the entity lower after flying up about 10 blocks? i don't like that the ai just endlessly rises.) 

Edited by aqology on Mon, 02/24/2025 - 06:00