mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19:44 +00:00
Grass update! 🥳
This commit is contained in:
parent
e16cf20340
commit
292581cf89
2 changed files with 156 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ class GrassBlock extends SolidBlock{
|
|||
$this->isActivable = true;
|
||||
$this->hardness = 3;
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(DIRT, 0, 1),
|
||||
|
|
@ -47,4 +48,18 @@ class GrassBlock extends SolidBlock{
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onUpdate($type){
|
||||
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
|
||||
if($type === BLOCK_UPDATE_RANDOM){
|
||||
if(mt_rand(0, 2) == 1){
|
||||
if($this->getSide(1)->isTransparent === false){
|
||||
$this->level->setBlock($this, BlockAPI::get(DIRT, 0), true, false, true);
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue