Block: add face and clickVector to onActivate() parameters, closes #267

this is an old old old issue, i don't know why it wasn't addressed sooner.
This commit is contained in:
Dylan K. Taylor
2019-02-13 14:29:59 +00:00
parent 55be0716d8
commit 7b6d76871c
28 changed files with 45 additions and 31 deletions

View File

@ -30,6 +30,7 @@ use pocketmine\item\ItemFactory;
use pocketmine\item\Shovel;
use pocketmine\level\generator\object\TallGrass as TallGrassObject;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\Player;
use pocketmine\utils\Random;
use function mt_rand;
@ -99,7 +100,10 @@ class Grass extends Solid{
}
}
public function onActivate(Item $item, Player $player = null) : bool{
public function onActivate(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($face !== Facing::UP){
return false;
}
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){
$item->pop();
TallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2);