mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 11:45:30 +00:00
Sugarcane now grows when using bonemeal
This commit is contained in:
parent
bd8110edab
commit
2d67af6fbd
@ -31,6 +31,27 @@ class SugarcaneBlock extends FlowableBlock{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onActivate(Item $item, Player $player){
|
||||||
|
if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||||
|
if($this->getSide(0)->getID() !== SUGARCANE_BLOCK){
|
||||||
|
for($y = 1; $y < 3; ++$y){
|
||||||
|
$b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
|
||||||
|
if($b->getID() === AIR){
|
||||||
|
$this->level->setBlock($b, new SugarcaneBlock(), true, false, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->meta = 0;
|
||||||
|
$this->level->setBlock($this, $this, true, false, true);
|
||||||
|
}
|
||||||
|
if(($player->gamemode & 0x01) === 0){
|
||||||
|
$item->count--;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate($type){
|
||||||
if($type === BLOCK_UPDATE_NORMAL){
|
if($type === BLOCK_UPDATE_NORMAL){
|
||||||
$down = $this->getSide(0);
|
$down = $this->getSide(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user