Added Shears check and drops [gh#749,750]

This commit is contained in:
Shoghi Cervantes 2013-08-25 20:40:25 +02:00
parent 02a8a3e881
commit 30483d5312
2 changed files with 13 additions and 5 deletions

View File

@ -262,6 +262,10 @@ class Item{
}
}
public function isShears(){
return ($this->id === SHEARS);
}
final public function __toString(){
return "Item ". $this->name ." (".$this->id.":".$this->meta.")";
}

View File

@ -141,12 +141,16 @@ class LeavesBlock extends TransparentBlock{
public function getDrops(Item $item, Player $player){
$drops = array();
if($item->isShears()){
$drops[] = array(LEAVES, $this->meta & 0x03, 1);
}else{
if(mt_rand(1,20) === 1){ //Saplings
$drops[] = array(SAPLING, $this->meta & 0x03, 1);
}
if(($this->meta & 0x03) === LeavesBlock::OAK and mt_rand(1,200) === 1){ //Apples
$drops[] = array(APPLE, 0, 1);
}
}
return $drops;
}
}