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

Result of /execute if items command can overflow

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • None
    • 1.21.1
    • None
    • Community Consensus
    • Commands

      /execute if items command can specify multiple targets and multiple slots, and returns the sum of all detected items as a result. However, if this result exceeds the int maximum (2147483647), it will overflow to a negative number and cause other unusual behaviors.

      • /execute if items ...
        • Fails when sum > 2147483647, which is
      • /execute if items ... run ...
        • Fails when sum > 2147483647, which is
      • /execute unless items ...
        • Fails when sum > 2147483647, which is
      • /execute unless items ... run ...
        • Succeeds when sum > 2147483647, which is

       

      Due to the massive number of entities, you'll need at least 4GB of memory to reproduce this.

      1. In the attached world file, run the command blocks.
      2. (Wait about ~3 minutes...)
      3. See the output message or SuccessCount value of the /execute if|unless items commands.

            Unassigned Unassigned
            Triton365 Triton365
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: