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

Setting the Count of an Item in a Villager Inventory adds that amount to the Count instead of setting it.

XMLWordPrintable

    • Unconfirmed
    • (Unassigned)

      A villager has an item in it's inventory:

       

      /data get entity <villager> Inventory 
      Villager has the following entity data: [{id: "minecraft:bread", Count: 1b}]

      If we now set the count of that Item to one nothing happens, as this is already the count. This is expected behavior. If we set it to 3 however, the Count gets increased by 3 instead of set to 3.

       

       

      /data modify entity <villager> Inventory[0].Count set value 3b
      /data get entity <villager> Inventory
      Villager has the following entity data: [{id: "minecraft:bread", Count: 4b}]

      If we now set the count to two, we increase the count by two.

      /data modify entity <villager> Inventory[0].Count set value 2b
      /data get entity <villager> Inventory
      Villager has the following entity data: [{id: "minecraft:bread", Count: 5b}] 

       

      Expected behavior:

       

      /data get entity <villager> Inventory 
      Villager has the following entity data: [{id: "minecraft:bread", Count: 1b}]
      
      /data modify entity <villager> Inventory[0].Count set value 3b
      /data get entity <villager> Inventory
      Villager has the following entity data: [{id: "minecraft:bread", Count: 3b}] 
      
      /data modify entity <villager> Inventory[0].Count set value 2b
      /data get entity <villager> Inventory
      Villager has the following entity data: [{id: "minecraft:bread", Count: 2b}] 

       

       

            Unassigned Unassigned
            PixelRayn PixelRayn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: