BlockTransaction
Methods
__construct()
php
public function __construct(\pocketmine\world\ChunkManager $world)addBlock()
php
public function addBlock(\pocketmine\math\Vector3 $pos, \pocketmine\block\Block $state) : selfAdds a block to the transaction at the given position.
addBlockAt()
php
public function addBlockAt(int $x, int $y, int $z, \pocketmine\block\Block $state) : selfAdds a block to the batch at the given coordinates.
addValidator()
php
public function addValidator(\Closure $validator) : voidAdd a validation predicate which will be used to validate every block. The callable signature should be the same as the below dummy function.
apply()
php
public function apply() : boolValidates and attempts to apply the transaction to the given world. If any part of the transaction fails to validate, no changes will be made to the world.
dummyValidator()
php
public function dummyValidator(\pocketmine\world\ChunkManager $world, int $x, int $y, int $z) : boolDummy function demonstrating the required closure signature for validators.
fetchBlock()
php
public function fetchBlock(\pocketmine\math\Vector3 $pos) : \pocketmine\block\BlockReads a block from the given world, masked by the blocks in this transaction. This can be useful if you want to add blocks to the transaction that depend on previous blocks should they exist.
fetchBlockAt()
php
public function fetchBlockAt(int $x, int $y, int $z) : \pocketmine\block\BlockgetBlocks()
php
public function getBlocks() : \Generator