Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-151953

/schedule fires before entities are fully loaded

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.18.20.21 Beta, 1.20.40.22 Preview, 1.20.30, 1.20.60.22 Preview
    • None
    • Confirmed
    • Windows
    • 717763

      The bug

      The 1.18.20.21 changelog included this line:

      Entities must now be loaded for an area to be considered fully loaded and ticking

      To me, this implies that /schedule on_area_loaded should now trigger only once all entities in a ticking area have loaded. However, this is still not the case.

      How to reproduce

      Due to the asynchronous nature of ticking areas, it's hard to reproduce this reliably. I do have a setup for testing this though, in the attached world.

      Basically, just push the bottom button. It loads a distant ticking area containing around 200 cows. A bunch of messages will print out, each containing a timestamp (the number of ticks that have passed since scheduling) and the number of cows that are loaded. The important one is the "schedule loaded at" line. That runs when /schedule triggers. If the number of loaded cows seen in that messages is less than 200, then /schedule triggered too early.

      If you couldn't reproduce, press the middle button, then press the bottom one again.

      More information

      The other messages (mentioning command blocks and cows) are the result of other attempts to wait for all entities to load.

      The command block just repeatedly checks for cows until it finds any, then prints how many. In the above example, only 5 were loaded at that time.

      Every cow also runs a function with an animation controller when initialized. This allows us to watch groups of cows load in real-time. In the above example, several cows were loaded over the course of 15 or so ticks.

      Lastly, the schedule function summons a new cow into the area. That cow is usually loaded last, so all cows have usually loaded by the time its animation controller goes off.

            tryashtar [Mod] tryashtar
            Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              CHK: