mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 04:29:43 +00:00
Many fix
Added rare drop from reactor Tall grass now drop only wheat seeds Fix utils::chance() Zombie now can drop carrot or potato
This commit is contained in:
parent
ccc51c8fe7
commit
ac60efb7ca
4 changed files with 27 additions and 39 deletions
|
|
@ -34,10 +34,9 @@ class TallGrassBlock extends FlowableBlock{
|
|||
|
||||
public function onUpdate($type){
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
if($this->getSide(0)->isTransparent === true){//Replace with common break method
|
||||
$this->level->setBlock($this, new AirBlock(), false, false, true);
|
||||
$random = mt_rand(0,3);
|
||||
if($random == 3) ServerAPI::request()->api->entity->drop(new Position($this->x + 0.5, $this->y, $this->z + 0.5, $this->level), BlockAPI::getItem(WHEAT_SEEDS));
|
||||
if(Utils::chance(15)) ServerAPI::request()->api->entity->drop(new Position($this->x + 0.5, $this->y, $this->z + 0.5, $this->level), BlockAPI::getItem(WHEAT_SEEDS));
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
}
|
||||
|
|
@ -46,34 +45,16 @@ class TallGrassBlock extends FlowableBlock{
|
|||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = array();
|
||||
$possibleDrops = array(
|
||||
array(WHEAT_SEEDS, 0, 1),
|
||||
array(CARROT, 0, 1),
|
||||
array(POTATO, 0, 1),
|
||||
array(BEETROOT_SEEDS, 0, 1),
|
||||
array(MELON_SEEDS, 0, 1),
|
||||
array(PUMPKIN_SEEDS, 0, 1),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
);
|
||||
if ($item->isShears()){
|
||||
$drops[] = array($this->id, $this->meta & 0x03, 1);
|
||||
}
|
||||
elseif(($item = $possibleDrops[mt_rand(0, count($possibleDrops) - 1)]) !== 0){
|
||||
$drops[] = $item;
|
||||
elseif(Utils::chance(15)){
|
||||
$drops[] = array(WHEAT_SEEDS, 0, 1)
|
||||
}
|
||||
return $drops;
|
||||
}
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() == 2 or $down->getID() == 3){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue