I am in Java 1.14.4 and I'm trying to create a custom crafting system using donkeys. ATM I am adding the ability for the items in the crafting grid to subtract their count whenever an item has been crafted.

Here I use Slot 2b as an example. I get the item count of whatever item is in Slot 2b, store that count into a scoreboard value, subtract the count by 1, and then store the count back into the donkey's inventory. I do this with:

execute store result score @s craftItemCount run data get entity @s Items[{Slot:2b}].Count 1

scoreboard players remove @s craftItemCount 1

execute store result entity @s Items[{Slot:2b}].Count byte 1 run scoreboard players get @s craftItemCount

However, the item count isn't automatically updated if the player has the chest donkey's GUI open. The inventory screen has to be closed and then reupdated for this to take effect. Meaning if the player takes the items out of the crafting grid after crafting an item, then the item count won't be subtracted at all and items could be easily duplicated. Is there a way around this?

  • I can't manage to get any change done in the mule inventory, no matter if I re-open the inventory or the world. /data modify insists that the data is already there, but /data get doesn't show it. Sadly bugs that can only be reproduced by changing the NBT of an entity during its lifetime are not accepted on the bug tracker (because it's an unsupported feature), so I can't even create a report for it. Oct 23, 2019 at 11:52
  • @FabianRöling Don't use data modify for this, try execute store result entity @e[type=donkey,limit=1] Items[{Slot:2b}].Count byte 1 run scoreboard players get @e[type=donkey,limit=1] craftItemCount. It will modify the data, but not when you are within the donkey's inventory.
    – Hydra
    Oct 23, 2019 at 14:29
  • @FabianRöling This directly stores the score into the entity instead of data modify, which doesn't work here for some reason.
    – Hydra
    Oct 23, 2019 at 15:11
  • That behaves like you say (tested in the snapshot). There's probably no way around it then, you'll need to use a different custom crafting system. If you don't need NBT in the output, you can just use the built-in recipes, otherwise for example dropping items on the floor is commonly done, because it's easy, and I like using droppers. Oct 23, 2019 at 18:19
  • @FabianRöling Do you know if there is a bug report on this?
    – Hydra
    Oct 23, 2019 at 18:54


You must log in to answer this question.

Browse other questions tagged .