mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-21 18:36:40 +00:00
Added Mushroom placement
This commit is contained in:
parent
a9c7a6642e
commit
3ecbe7dbf7
@ -512,23 +512,6 @@ class BlockAPI{
|
||||
}
|
||||
|
||||
/*switch($data["block"]){
|
||||
case 6:
|
||||
if($target[0] === 60){
|
||||
break;
|
||||
}
|
||||
case 37:
|
||||
case 38:
|
||||
if(($target[0] !== 2 and $target[0] !== 3) or $data["face"] !== 1){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 39://Mushrooms
|
||||
case 40:
|
||||
$blockDown = $this->server->api->level->getBlock($data["x"], $data["y"] - 1, $data["z"]);
|
||||
if(isset(Material::$transparent[$blockDown[0]])){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 338:
|
||||
case 83: //Sugarcane
|
||||
$data["block"] = 83;
|
||||
|
@ -31,4 +31,14 @@ class BrownMushroomBlock extends FlowableBlock{
|
||||
$this->isFlowable = true;
|
||||
}
|
||||
|
||||
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->isTransparent === false){
|
||||
$level->setBlock($block, $this->id, $this->getMetadata());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -30,5 +30,15 @@ class RedMushroomBlock extends FlowableBlock{
|
||||
parent::__construct(RED_MUSHROOM, 0, "Red Mushroom");
|
||||
$this->isFlowable = true;
|
||||
}
|
||||
|
||||
|
||||
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->isTransparent === false){
|
||||
$level->setBlock($block, $this->id, $this->getMetadata());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user