Minecraft Command Blocks, using /data string values within other commands
In Minecraft I'm able to determine the id of the first item in a chest with the following command:
/data get block <chest coordinates> Items[0].id
which returns the id as string value. For example if the chest contained stone, the value returned would be "minecraft:stone". I'd like to used this returned value in other commands
For instance you can set an area to be stone with the command:
/fill <start coordinates> <end coorinates> minecraft:stone
What I'd like to do is something to the effect of:
/fill <start coordinates> <end coorinates> run data get block <chest coordinates> Items[0].id
but this doesn't work. I assume I just have the syntax wrong, but I can't find anything online to give me any guidance.
TLDR: Is there a way to use string values derived from a /data command, in other commands?
Minecraft does not have good string handling (yet, I assume that will change soon). A command like you imagined it would be great, but doesn't exist. The best you could do would be hardcoding many different values for blocks and have one fill command for each of them.
In your case it might potentially be possible to summon an army of endermen, give them all the block by moving the NBT over, then forcing them to stay in one place until they put the block down. But I guess that's harder than just hardcoding a few different blocks. :D