mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
Place/Breaking/Activation logic separated from BlockAPI
This commit is contained in:
parent
6156baab85
commit
d9c87161ba
37 changed files with 387 additions and 216 deletions
|
|
@ -26,14 +26,26 @@ the Free Software Foundation, either version 3 of the License, or
|
|||
*/
|
||||
|
||||
class LeavesBlock extends TransparentBlock{
|
||||
const OAK = 0;
|
||||
const SPRUCE = 1;
|
||||
const BIRCH = 2;
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(LEAVES, $meta, "Leaves");
|
||||
$names = array(
|
||||
0 => "Oak Leaves",
|
||||
1 => "Spruce Leaves",
|
||||
2 => "Birch Leaves",
|
||||
LeavesBlock::OAK => "Oak Leaves",
|
||||
LeavesBlock::SPRUCE => "Spruce Leaves",
|
||||
LeavesBlock::BIRCH => "Birch Leaves",
|
||||
);
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = array();
|
||||
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(260, 0, 1);
|
||||
}
|
||||
return $drops;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue