I am trying to make a commands system that forces a player to drop whatever item is in their main hand. Because I can't use commands to make a player press Q and drop the original item, I need to copy the NBT into a new item on the ground and remove the old one from the player. I obviously want any NBT, including enchantments, names, lore, etc. to be copied over exactly.
I know that I can use
/data to get the NBT from the
SelectedItem of a player, and
execute store can put NBT into an entity. However,
/data get only returns numeric data, and
execute store only allows me to set one NBT path at a time, so my plan of summoning a generic item on the ground and then just copying the NBT over (including the item ID) does not work.
Am I going about this wrong and there is a way to do this, or is this just impossible? My eventual plan is to implement this into a datapack, so if a method requires moving items into tile entities or something similar involving setting aside a space to spawn blocks in I'd rather avoid that. Of course, if you know a method like that by all means put it as an answer because someone else with the same question may find it useful for their situation.