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

Items in a container can be given a count above 99 (to max integer), and can crash the world

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w19a
    • 1.20.5 Pre-Release 1, 1.20.5 Release Candidate 2, 1.20.6
    • None
    • Confirmed
    • Crash
    • Very Important
    • Platform

      Using the following give command, item stacks can be given extremely high counts up to the java max integer.

      /give @s barrel[container=[{slot:0,item:{id:wooden_sword,count:2147483647}}]]

      Placing and then breaking the barrel will cause the stack to split into smaller stacks, spawn at least a few hundred million item entities, and crash the world. The split stacks seem to have random counts around 10 to 30, so it's slightly less than 2 billion entities spawned at once.

      Using commands to get an item with max_stack_size above 99 will detect and remove the invalid component, and setting the item count to below 1 will set it back to 1. Expected behavior would be for item count to be limited to the max_stack_size (or at least a hard coded max of 99).

            Dat12 [Mojang] etanaratsastaja
            42Richtofen42 42Richtofen42
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: