I want to fill a large area (approximately 40000 blocks in volume, 100x 4y 100z) with random blocks, and as quickly as possible. The area is not solid; it has air blocks which are not intended to be filled. I currently have a method to do so, but it is slow and it crunches TPS. My current method is to use a wall made up of individual area_effect_clouds. Each one chooses a random block to place at its position, and when all the clouds have done so, the wall moves 1 block forward.
Are there any better ways to do this?
Best Answer
You can solve this with a datapack, I used the namespace
maze
.For this to know where to replace blocks you need to place a root armor stand with these (
{Marker:1,Tags:[root,rootTwo,rootThree,stoneBricks],Invisible:1}
) NBT tags at the position with the lowest x, y, and z values. This setup may replace any non-air block that is in a 100x4x100 block and about 33% stay the same as they were originally. You can change the amount of layers in the third command.The command to place the root armor stand should look like this:
The main function (call this after placing the root armor stand):
The
maze:place
function (called by the main function):It took my computer 10 seconds to run this, though I was able to continue playing smoothly with still acceptable fps. It is possible to tweak this to go faster, but the performance may suffer.
In a sample of 10000 blocks there were