Mojira Archive
MC-277341

Result of /execute if items command can overflow

/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.

Won't Fix

Triton365

2024-10-06, 12:17 PM

2024-10-23, 07:24 AM

2024-10-23, 07:24 AM

1

1

Community Consensus

Commands

1.21.1

-