Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-143266

Nested function calls reevaluate maxCommandChainLength before queueing commands

XMLWordPrintable

    • Confirmed
    • Commands

      The bug

      Functions only consider the value of the gamerule maxCommandChainLength when the function starts, but should ignore any changes to it while the commands are running, see MC-124447.

      However, this is not the case when a nested function is executed. In this case the length of the queued commands is compared with the current maxCommandChainLength value.

      How to reproduce

      1. Download the attached datapack MC-143266.zip and place it in the datapacks folder of your world
      2. Run the function test:run_nested
        /function test:run_nested
        

        It did not run any of the commands from the test:nested function; you can slightly increase the value set for maxCommandChainLength in test:run_nested and the nested function will be executed

      Code analysis

      See net.minecraft.advancements.FunctionManager.execute(FunctionObject, CommandSource) (MCP name)

      Solution: The maxCommandChainLength value could be stored in a field when the execution of a function starts and then the value of the field can be used for nested functions.

            boq [Mojang] Bartosz Bok
            marcono1234 Marcono1234
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: