mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 17:29:44 +00:00
Added new Saplings
This commit is contained in:
parent
bbb69429f3
commit
2d5e98b6a3
@ -42,8 +42,10 @@ class Sapling extends Flowable{
|
|||||||
1 => "Spruce Sapling",
|
1 => "Spruce Sapling",
|
||||||
2 => "Birch Sapling",
|
2 => "Birch Sapling",
|
||||||
3 => "Jungle Sapling",
|
3 => "Jungle Sapling",
|
||||||
|
4 => "Acacia Sapling",
|
||||||
|
5 => "Dark Oak Sapling",
|
||||||
);
|
);
|
||||||
$this->name = $names[$this->meta & 0x03];
|
$this->name = $names[$this->meta & 0x07];
|
||||||
$this->hardness = 0;
|
$this->hardness = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +62,7 @@ class Sapling extends Flowable{
|
|||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null){
|
||||||
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
||||||
Tree::growTree($this->getLevel(), $this, new Random(mt_rand()), $this->meta & 0x03);
|
Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->meta & 0x07);
|
||||||
if(($player->gamemode & 0x01) === 0){
|
if(($player->gamemode & 0x01) === 0){
|
||||||
$item->count--;
|
$item->count--;
|
||||||
}
|
}
|
||||||
@ -83,7 +85,7 @@ class Sapling extends Flowable{
|
|||||||
}elseif($type === Level::BLOCK_UPDATE_RANDOM){ //Growth
|
}elseif($type === Level::BLOCK_UPDATE_RANDOM){ //Growth
|
||||||
if(mt_rand(1, 7) === 1){
|
if(mt_rand(1, 7) === 1){
|
||||||
if(($this->meta & 0x08) === 0x08){
|
if(($this->meta & 0x08) === 0x08){
|
||||||
Tree::growTree($this->getLevel(), $this, new Random(mt_rand()), $this->meta & 0x03);
|
Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->meta & 0x07);
|
||||||
}else{
|
}else{
|
||||||
$this->meta |= 0x08;
|
$this->meta |= 0x08;
|
||||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||||
@ -100,7 +102,7 @@ class Sapling extends Flowable{
|
|||||||
|
|
||||||
public function getDrops(Item $item){
|
public function getDrops(Item $item){
|
||||||
return array(
|
return array(
|
||||||
array($this->id, $this->meta & 0x03, 1),
|
array($this->id, $this->meta & 0x07, 1),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user