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

Cannot select entities who have any itemstack with the count being 1.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w10a
    • 24w09a
    • None
    • Confirmed
    • Commands
    • Important
    • Platform

      In 24w09a, the count tag in an item stack is removed when there's only one item in the stack. This is not friendly to command players.

      This change may be intentional to reduce the size of level files, but changing the behaviors of commands may be unintentional. So, I report it as a bug.

      Before 24w09a, to select chest boats that have any item stack that has only one oak_log:

      /execute as @e[type=chest_boat,nbt={Items:[{id:"minecraft:oak_log",Count:1b}]}] run say I have an oak log stack with Count being 1.
      

      Currently, because item stacks with count being 1 have no "count" tag, the following command doesn't work at all:

      /execute as @e[type=chest_boat,nbt={Items:[{id:"minecraft:oak_log",count:1}]}] run say I have an oak log stack with count being 1.
      

      The following command also doesn't work. It says the message no matter how many items are in an oak_log item stack.

      /execute as @e[type=chest_boat,nbt={Items:[{id:"minecraft:oak_log"}]}] run say I have an oak log stack with count being 1.
      

      This also affects comparing or counting the "count"s of item stacks, storing or modifying the counts of item stacks, etc.

      There are workarounds, but complex functions or complex scoreboard operations are needed, making them too complex for most command players. And they may also result in poor performance.

      In my opinion, for commands, the count tag in an item stack should always exist to be obtaining by command players.

            gegy1000 [Mojang] Gegy
            Chixvv Dl
            Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: