How can I randomly set/spawn blocks in my world (and remove)? I want to spawn stone blocks all over the world (only over trees and grass...)
This is a tricky question. There are many ways to do it, but the method that won't affect the server's performance at all would be to override the generator, which can be done easily. However, there's a problem you'll be facing..
PHP: $level = $this->getServer()->getLevelByName("Your Level");$x =mt_ rand(0, 255);$z = mt_rand(0, 255);$y = mt_rand($level->getHighestBlockAt($x, $z), 127);$pos = new Vector3($x, $y, $z);$block = 5;$level->setBlock($pos, $block); This may help you it spawn random block but idk how over tree and grass
And how can I remove all blocks with that id from the level? *Your code isn't working (I already added a space to the =) Code: "syntax error, unexpected 'rand' (
PHP dosent care about whatever code style you use PS you should store the vector so to be removed latter
I can't use a generator, because I need to spawn and despawen the blocks in a Minigame. What I the best method?