Code:
[1608] Sets the block at the given coordinates.
[1609]
[1610] If $update is true, it'll get the neighbour blocks (6 sides) and update them, and also update local lighting.
[1611] If you are doing big changes, you might want to set this to false, then update manually.
[1612]
[1613] @throws \InvalidArgumentException if the position is out of the world bounds
[1614] */
[1615] public function setBlockAt(int $x, int $y, int $z, Block $block, bool $update = true) : void{
[1616] if(!$this->isInWorld($x, $y, $z)){
[1617] throw new \InvalidArgumentException("Pos x=$x,y=$y,z=$z is outside of the world bounds");
[1618] }
[1619] $chunkX = $x >> Chunk::COORD_BIT_SIZE;
[1620] $chunkZ = $z >> Chunk::COORD_BIT_SIZE;
[1621] if($this->loadChunk($chunkX, $chunkZ) === null){ //current expected behaviour is to try to load the terrain synchronously
[1622] throw new WorldException("Cannot set a block in un-generated terrain");
[1623] }
[1624]
[1625] $this->timings->setBlock->startTiming();
[1626]
[1627] $this->unlockChunk($chunkX, $chunkZ, null);
Player as put Piston and push block to Y = -1 (no bedrock at this emplacement)
Error: Pos x=2051,y=-1,z=7552 is outside of the world bounds File: pmsrc/src/world/World Line: 1617 Type: InvalidArgumentException Backtrace:
0 pmsrc/src/world/World(1604): pocketmine\world\World->setBlockAt(int 2051, int -1, int 7552, object tedo0627\redstonecircuit\block\mechanism\BlockMoving#331915, true)
1 plugins/RedstoneCircuit_dev-83.phar/src/tedo0627/redstonecircuit/block/mechanism/BlockPiston(161): pocketmine\world\World->setBlock(object pocketmine\world\Position#486119, object tedo0627\redstonecircuit\block\mechanism\BlockMoving#331915)
2 plugins/RedstoneCircuit_dev-83.phar/src/tedo0627/redstonecircuit/block/mechanism/BlockPiston(107): tedo0627\redstonecircuit\block\mechanism\BlockPiston->push()
3 pmsrc/src/world/World(850): tedo0627\redstonecircuit\block\mechanism\BlockPiston->onScheduledUpdate()
4 pmsrc/src/world/World(807): pocketmine\world\World->actuallyDoTick(int 39945)
5 pmsrc/src/world/WorldManager(362): pocketmine\world\World->doTick(int 39945)
6 pmsrc/src/Server(1776): pocketmine\world\WorldManager->tick(int 39945)
7 pmsrc/src/Server(1658): pocketmine\Server->tick()
8 pmsrc/src/Server(1047): pocketmine\Server->tickProcessor()
9 pmsrc/src/PocketMine(304): pocketmine\Server->__construct(object BaseClassLoader#2, object pocketmine\utils\MainLogger#3, string[16] /home/container/, string[24] /home/container/plugins/)
10 pmsrc/src/PocketMine(327): pocketmine\server()
11 pmsrc(11): require(string[60] phar:///home/container/PocketMine-MP.phar/src/PocketMine.php)
Code: [1608] Sets the block at the given coordinates. [1609] [1610] If $update is true, it'll get the neighbour blocks (6 sides) and update them, and also update local lighting. [1611] If you are doing big changes, you might want to set this to false, then update manually. [1612] [1613] @throws \InvalidArgumentException if the position is out of the world bounds [1614] */ [1615] public function setBlockAt(int $x, int $y, int $z, Block $block, bool $update = true) : void{ [1616] if(!$this->isInWorld($x, $y, $z)){ [1617] throw new \InvalidArgumentException("Pos x=$x,y=$y,z=$z is outside of the world bounds"); [1618] } [1619] $chunkX = $x >> Chunk::COORD_BIT_SIZE; [1620] $chunkZ = $z >> Chunk::COORD_BIT_SIZE; [1621] if($this->loadChunk($chunkX, $chunkZ) === null){ //current expected behaviour is to try to load the terrain synchronously [1622] throw new WorldException("Cannot set a block in un-generated terrain"); [1623] } [1624] [1625] $this->timings->setBlock->startTiming(); [1626] [1627] $this->unlockChunk($chunkX, $chunkZ, null);