(Java Minecraft 1.14) Snowball entity tag:{} not copied over for last item in a stack

I'm doing a remake of my old Holy Hand Grenade item, but with snowballs rather than potions this time. However, I've run up against a very odd issue. I give the item with this command:

give @s minecraft:snowball{dmd_grenade:1b,CustomModelData:256,display:{Name:"{\"text\":\"Holy Hand Grenade\",\"color\":\"yellow\",\"italic\":\"false\"}"}} 1

And detect it being thrown by running this command every tick:

execute as @e[type=minecraft:snowball,distance=..1.75,tag=!dmd_grenade,nbt={Item:{tag:{dmd_grenade:1b}}}] at @s run function dark_magic:items/throw_grenade

This function, throw_grenade, tags the snowball and summons an armorstand which is teleported along with it until the snowball hits something, at which point the armorstand summons a charged creeper and kills itself. This all works great until you try it in survival with only one in your hand. If you have 2, 3, 4, ...16, everything is fine, but when you put only 1, it just doesn't work. The throw_grenade function is not run, and the grenade is just a dud.

I heard that something similar happens with the minecraft:consume_item advancement trigger in datapacks, where if there is only one item left it doesn't detect NBT. Why does this happen, and is there any workaround? I know one possibility would be doubling everything, so a player gets two snowballs at a time, and when they throw one it takes an extra from their hand, but that's just clunky, ugly, and prone to error if the player doesn't pay attention and divides them into two stacks of one.

Finally, is there a bug report on this? If there isn't, can someone make one?


Solution 1:

This is a known bug: https://bugs.mojang.com/browse/MC-144688

In the future, if you want to quickly search all open Minecraft reports, use this custom search engine in e.g. Chrome:

https://bugs.mojang.com/browse/MC-0?jql=project%20%3D%20MC%20AND%20status%20in%20(Open%2C%20"In%20Progress"%2C%20Reopened%2C%20Postponed)%20AND%20text%20~%20"%s"

Edit: This bug is now fixed in snapshot 19w35a (for 1.15.0).