1

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?

  • This isn't really a good question for gamingSE. You've already tested this extensively and figured out that it's a bug. Now the only thing left to do is making clear reproduction steps (like "run /data get bla bla bla to see that it doesn't have the NBT") and submitting a bug report if you can't find an existing one. Even if there is one you didn't find, that's fine, the mods will just close it as duplicate. – Fabian Röling Aug 9 at 2:22
  • @FabianRöling Ok. I posted it mainly to see if there's a better workaround, but I don't think I made that clear enough. – Nik3141 Aug 9 at 4:10
  • Maybe tagging everyone who holds such a custom snowball, removing the tag when they don't and then do your regular snowball entity stuff without checking its NBT. This could still be circumvented by a player by selecting a different item and then very quickly selecting and throwing the snowball (or custom clients or whatever). You also might need to consider the offhand. – Fabian Röling Aug 9 at 4:39
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"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.