Skip to content

BlockTransaction ​

class · pocketmine\world\BlockTransaction · source

Methods ​

__construct() ​

php
public function __construct(\pocketmine\world\ChunkManager $world)

addBlock() ​

php
public function addBlock(\pocketmine\math\Vector3 $pos, \pocketmine\block\Block $state) : self

Adds a block to the transaction at the given position.

addBlockAt() ​

php
public function addBlockAt(int $x, int $y, int $z, \pocketmine\block\Block $state) : self

Adds a block to the batch at the given coordinates.

addValidator() ​

php
public function addValidator(\Closure $validator) : void

Add 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() : bool

Validates 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) : bool

Dummy function demonstrating the required closure signature for validators.

fetchBlock() ​

php
public function fetchBlock(\pocketmine\math\Vector3 $pos) : \pocketmine\block\Block

Reads 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\Block

getBlocks() ​

php
public function getBlocks() : \Generator

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.