mojira.dev
MC-257794

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

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}]

 

 

Linked issues

Comments 3

Duplicate of MC-112826, fixed in the snapshots.

According to the original issue this had been resolved at 26/Jan/17, before the 1.19.2 update was released, therefore this has to be a separate issue.

The other possibility is, that the original issue has not been resolved and is incorrectly tagged as resolved, so which snapshot was this fixed in?

PixelRayn

(Unassigned)

Unconfirmed

(Unassigned)

Command, CommandBlock, datapack, nbt

1.19.2

Retrieved