This code should spawn the structure, but it will only spawn one block PHP: public function spawnStructure(Vector3 $pos, Level $lv, int $id) : void{ $structure=$this->getStructure($id); $blocks=$structure->getBlocks(); foreach($blocks as $blstr){ $arr=explode(',', $blstr); $x=str_replace("x", $pos->getX(), $arr[0]); $y=str_replace("y", $pos->getY(), $arr[1]); $z=str_replace("z", $pos->getZ(), $arr[2]); $lv->setBlock(new Vector3($x, $y, $z), Block::get($arr[3])); } } blocks array be like: ["x, y+1, z-1, 54"] I m really dont know why this is not working. Thanks for help
This code should spawn the structure, but it will spawn only one block of all (the last one), the getBlocks () function returns an array of blocks that looks something like this: ["x, y+1, z, 54", "x-2, y, z, 87", "x, y, z, 56"]
It doesnt evaluate the expression string, Im surprised you can even run that code You cant pass something like "5+1" when it expects an int, it wont do the addition for you