Using the following item in survival mode:
/give @s minecraft:snowball{custom:true} 2
Command to verify data:
/data get entity @e[type=minecraft:snowball,limit=1] Item
When there's more than 1 item left in the stack, /data
will show the item's data. If the snowball thrown was the last item in the stack, the Item
will be nonexistent.
Code analysis in
net.minecraft.world.item.SnowballItem