some new blocks

This commit is contained in:
FreeHij 2023-02-21 21:08:26 +03:00
parent 9b5a3959c4
commit 1a01483453
18 changed files with 395 additions and 9 deletions

View file

@ -0,0 +1,22 @@
<?php
class MyceliumBlock extends SolidBlock{
public function __construct(){
parent::__construct(MYCELIUM, 0, "Mycelium");
$this->isActivable = true;
$this->hardness = 3;
}
public function getDrops(Item $item, Player $player){
return array(
array(DIRT, 0, 1),
);
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_RANDOM && !$this->getSide(1)->isTransparent && mt_rand(0, 2) == 1){
$this->level->setBlock($this, BlockAPI::get(DIRT, 0), true, false, true);
}
return BLOCK_UPDATE_RANDOM;
}
}