Start using transactions for block placement

This commit is contained in:
Dylan K. Taylor
2019-06-08 18:56:27 +01:00
parent f84040a7ad
commit c1f900ab18
50 changed files with 172 additions and 129 deletions

View File

@ -30,6 +30,7 @@ use pocketmine\item\Item;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\Player;
use pocketmine\world\BlockTransaction;
use function mt_rand;
abstract class Crops extends Flowable{
@ -52,9 +53,9 @@ abstract class Crops extends Flowable{
return 0b111;
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($blockReplace->getSide(Facing::DOWN)->getId() === BlockLegacyIds::FARMLAND){
return parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
}
return false;