This is a useful command block creation which lets you spawn a quarry machine which will automatically mine an area of 7×7 blocks and collect the item into a chest. Since it’s using command blocks it’s only possible to use this for worlds where you can enable creative mode since it’s required for obtaining the command blocks.
How does it work?
Press the button on the side of the command block machine to spawn a chest. The chest contain the necessary items which you will need for spawning the quarry. Use the quarry (cow) spawn egg to build the quarry.
Then toggle the lever on the command block machine to start mining the blocks. All of the mined blocks will drop down the hopper into the chest. You can stop the machine from mining by using simply using the same lever again.