Added more features to the World Generator

This commit is contained in:
Shoghi Cervantes
2013-05-26 13:22:22 +02:00
parent 424dba2fdd
commit aefcfad296
10 changed files with 104 additions and 56 deletions

View File

@ -54,7 +54,7 @@ class SaplingBlock extends TransparentBlock{
public function onActivate(Item $item, Player $player){
if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal
TreeObject::growTree($this->level, $this, $this->meta);
TreeObject::growTree($this->level, $this, new Random(), $this->meta & 0x03);
return true;
}
return false;
@ -63,7 +63,7 @@ class SaplingBlock extends TransparentBlock{
public function onUpdate($type){
if($type === BLOCK_UPDATE_RANDOM and mt_rand(0,2) === 0){ //Growth
if(($this->meta & 0x08) === 0x08){
TreeObject::growTree($this->level, $this);
TreeObject::growTree($this->level, $this, new Random(), $this->meta & 0x03);
}else{
$this->meta |= 0x08;
$this->level->setBlock($this, $this);