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

Food with a custom container item doesn't stack properly.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.21
    • None
    • Unconfirmed
    • (Unassigned)

      When a stackable food item has the "using_converts_to" component applied via datapack or commands, it is initially treated as stackable, but does not properly maintain stackability.

       

      When an item modified this way is dropped from a loot table, it will stack with other like items dropped from the same loot table as long as the world remains loaded. However, exiting the world and re-entering will cause all future instances of the same loot table entry to be treated as an entirely separate item, despite having identical item components. (See attached screenshot; the two meat shanks seen in the hotbar were generated in separate sessions and do not stack despite having identical food data).

       

      Additionally, splitting one stack of such items in half and then attempting to re-stack them results in the two stacks becoming separate instances, preventing you from restacking them again.

       

      I won't pretend to know exactly why this is happening, but my best guess is that there's some leftover code saying that food with containers shouldn't be stackable, despite the fact that eating the food while stacked drops the container item just fine. This is a really unfortunate bug, as it prevents the "using_converts_to" property from being usable for survival datapacks without creating a super annoying experience for the player.

       

      To see this in action, download the attached datapack, add to a world, then summon and kill a bunch of Camels. They should drop modified Beef items, which will stack when you first pick them up. Then exit and re-enter the world and do the same thing to receive an identical instance of modified Beef that will not stack with the first one.

            Unassigned Unassigned
            delocuro Erik Morris
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: