mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Added Shears check and drops [gh#749,750]
This commit is contained in:
parent
02a8a3e881
commit
30483d5312
@ -261,6 +261,10 @@ class Item{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isShears(){
|
||||||
|
return ($this->id === SHEARS);
|
||||||
|
}
|
||||||
|
|
||||||
final public function __toString(){
|
final public function __toString(){
|
||||||
return "Item ". $this->name ." (".$this->id.":".$this->meta.")";
|
return "Item ". $this->name ." (".$this->id.":".$this->meta.")";
|
||||||
|
@ -141,11 +141,15 @@ class LeavesBlock extends TransparentBlock{
|
|||||||
|
|
||||||
public function getDrops(Item $item, Player $player){
|
public function getDrops(Item $item, Player $player){
|
||||||
$drops = array();
|
$drops = array();
|
||||||
if(mt_rand(1,20) === 1){ //Saplings
|
if($item->isShears()){
|
||||||
$drops[] = array(SAPLING, $this->meta & 0x03, 1);
|
$drops[] = array(LEAVES, $this->meta & 0x03, 1);
|
||||||
}
|
}else{
|
||||||
if(($this->meta & 0x03) === LeavesBlock::OAK and mt_rand(1,200) === 1){ //Apples
|
if(mt_rand(1,20) === 1){ //Saplings
|
||||||
$drops[] = array(APPLE, 0, 1);
|
$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;
|
return $drops;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user