bounds for pmflevel methods, random block ticking ported from 0.1.3 core, player height was decreased a bit

This commit is contained in:
GameHerobrine 2023-06-23 07:41:04 +03:00
parent 84dd0b82b3
commit 3dd9e38a37
22 changed files with 326 additions and 216 deletions

View file

@ -16,7 +16,14 @@ class BeetrootBlock extends FlowableBlock{
}
return false;
}
public static function onRandomTick(Level $level, $x, $y, $z){
if(mt_rand(0, 2) == 1){
$b = $level->level->getBlock($x, $y, $z);
if($b[1] < 0x07){
$level->fastSetBlockUpdate($x, $y, $z, $b[0], $b[1] + 1);
}
}
}
public function onActivate(Item $item, Player $player){
if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal
$this->meta += mt_rand(0, 3) + 2;
@ -39,16 +46,6 @@ class BeetrootBlock extends FlowableBlock{
$this->level->setBlock($this, new AirBlock(), false, false, true);
return BLOCK_UPDATE_NORMAL;
}
}elseif($type === BLOCK_UPDATE_RANDOM){
if(mt_rand(0, 2) == 1){
if($this->meta < 0x07){
++$this->meta;
$this->level->setBlock($this, $this, true, false, true);
return BLOCK_UPDATE_RANDOM;
}
}else{
return BLOCK_UPDATE_RANDOM;
}
}
return false;
}