mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Seed placement
This commit is contained in:
parent
65280d85d1
commit
a718294a08
@ -171,8 +171,6 @@ class BlockAPI{
|
||||
$drops = $target->getDrops($item, $player);
|
||||
|
||||
/*switch($target->getID()){
|
||||
case 62:
|
||||
$drop[0] = 61;
|
||||
case 50: //Drop without metadata
|
||||
case 53:
|
||||
case 54:
|
||||
@ -188,24 +186,6 @@ class BlockAPI{
|
||||
case 156:
|
||||
$drop[1] = 0;
|
||||
break;
|
||||
case 64: //Wood Door
|
||||
case 71: //Iron Door
|
||||
if(($target->getMetadata() & 0x08) === 0x08){
|
||||
$down = $this->getBlock($target->x, $target->y - 1, $target->z);
|
||||
if($down->getID() === $target->getID()){
|
||||
$data2 = $data;
|
||||
--$data2["y"];
|
||||
$this->server->trigger("player.block.break", $data2);
|
||||
}
|
||||
}else{
|
||||
$up = $this->getBlock($target->x, $target->y + 1, $target->z);
|
||||
if($up->getID() === $target->getID()){
|
||||
$data2 = $data;
|
||||
++$data2["y"];
|
||||
$this->server->trigger("player.block.break", $data2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}*/
|
||||
$target->onBreak($this, $item, $player);
|
||||
|
||||
|
@ -29,5 +29,20 @@ class MelonStemBlock extends TransparentBlock{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(MELON_STEM, $meta, "Melon Stem");
|
||||
}
|
||||
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){
|
||||
return array(
|
||||
array(MELON_SEEDS, 0, mt_rand(0, 2)),
|
||||
);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -29,5 +29,9 @@ class MelonBlock extends TransparentBlock{
|
||||
public function __construct(){
|
||||
parent::__construct(MELON_BLOCK, 0, "Melon Block");
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(MELON_SLICE, 0, mt_rand(3, 7)),
|
||||
);
|
||||
}
|
||||
}
|
33
src/classes/material/item/generic/MelonSeeds.php
Normal file
33
src/classes/material/item/generic/MelonSeeds.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|
||||
-
|
||||
/ \
|
||||
/ \
|
||||
/ PocketMine \
|
||||
/ MP \
|
||||
|\ @shoghicp /|
|
||||
|. \ / .|
|
||||
| .. \ / .. |
|
||||
| .. | .. |
|
||||
| .. | .. |
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
class MelonSeedsItem extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
$this->block = BlockAPI::get(MELON_STEM);
|
||||
parent::__construct(MELON_SEEDS, 0, $count, "Melon Seeds");
|
||||
}
|
||||
}
|
33
src/classes/material/item/generic/WheatSeeds.php
Normal file
33
src/classes/material/item/generic/WheatSeeds.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|
||||
-
|
||||
/ \
|
||||
/ \
|
||||
/ PocketMine \
|
||||
/ MP \
|
||||
|\ @shoghicp /|
|
||||
|. \ / .|
|
||||
| .. \ / .. |
|
||||
| .. | .. |
|
||||
| .. | .. |
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
class WheatSeedsItem extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
$this->block = BlockAPI::get(WHEAT_BLOCK);
|
||||
parent::__construct(WHEAT_SEEDS, 0, $count, "Wheat Seeds");
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user