How to replace a block in a region with an entity[]
The last one was outdated, limited to certain items, and didn't even work. amazing56789 updated it to this ↓
parenthises: command or part of a command
text: have to put this in
angle brackets: replace this with your own, but required
square brackets: optional
One Way:
First select the region with fill. (/fill <coordinate of first corner> <coordinate of second corner>). Now, replace it with a command block: (/fill <coordinate of first corner> <coordinate of second corner> command_block{auto:1,Command:"/summon <Entity> ~ ~2 ~"} [replace <block>]. You should have a bunch of command blocks with items on top of them if you ran the SINGLE command. Now to clear the command blocks, and replace them with your own block: (/fill <coordinate of first corner> <coordinate of second corner> <whatever block you want to make it> replace command_block). If there are other command blocks that you don't want to replace, do this: (/fill <coordinate of first corner> <coordinate of second corner> <whatever block you want to make it> replace command_block{auto:1,Command:"/summon <Entity> ~ ~2 ~"}). To make them items, replace (<Entity>) with item{Item:{id:[minecraft:]<whatever item>,Count:<how many items for each block>}}. Now you should have entities on top of blocks!
Explanation
↓
You fill a region with command blocks that automatically activate. These command blocks summon the entities. Then, you replace the command blocks with your own blocks.
Sorry I couldn't remove these ↓
Example of it in use