i want to make it possible for portal blocks to drop

by obstruction of the block, either by explosion, or mushroom, i want to make it possible to drop a block, would it be possible to calculate how many blocks are broken, and then drop a custom item, which when placed is a portal block?

Continue to help post