mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19:44 +00:00
Seed placement
This commit is contained in:
parent
65280d85d1
commit
a718294a08
6 changed files with 101 additions and 25 deletions
|
|
@ -27,16 +27,27 @@ the Free Software Foundation, either version 3 of the License, or
|
|||
|
||||
class WheatBlock extends FlowableBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(WHEAT_BLOCK, $meta, "Wheat");
|
||||
parent::__construct(WHEAT_BLOCK, $meta, "Wheat Block");
|
||||
}
|
||||
|
||||
public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($block->inWorld === true){
|
||||
$down = $level->getBlockFace($block, 0);
|
||||
if($down->getID() === 60){
|
||||
$level->setBlock($block, $this->id, $this->getMetadata());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = array();
|
||||
if($this->meta >= 0x07){
|
||||
$drops[] = array(296, 0, 1);
|
||||
$drops[] = array(295, 0, mt_rand(0, 3));
|
||||
$drops[] = array(WHEAT, 0, 1);
|
||||
$drops[] = array(WHEAT_SEEDS, 0, mt_rand(0, 3));
|
||||
}else{
|
||||
$drops[] = array(295, 0, 1);
|
||||
$drops[] = array(WHEAT_SEEDS, 0, 1);
|
||||
}
|
||||
return $drops;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue