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

/give is slow when no target is found


    • Icon: Bug Bug
    • Resolution: Fixed
    • Preview, 1.20.80
    • Preview, 1.19.22 Hotfix, 1.20.51 Hotfix
    • None
    • Confirmed
    • Multiple
    • 1177623

      The bug

      The /give and /replaceitem commands are slow even when no players are found by the selector. They're especially slow when the specified item has a lot of components, even though there was nobody to even give the item to, so no item should be generated.

      How to reproduce

      1. Download and open the attached world
      2. Pull the levers next to the command blocks (the two marked with blue concrete are the most important), one at a time
      3. Observe the server performance for each:
        • The one on the left tries to give a sword to a non-existent player, 30,000 times per tick
        • The one on the right tries to execute as a non-existent player to give themselves a sword, 30,000 times per tick

      Expected behavior

      Server performance is identical

      Observed behavior

      Left command blocks tank the server, right slows it only a bit

            tryashtar [Mod] tryashtar
            5 Vote for this issue
            3 Start watching this issue