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

@ -31,7 +31,16 @@ class WheatBlock extends FlowableBlock{
}
return false;
}
public static function onRandomTick(Level $level, $x, $y, $z){
if(mt_rand(0, 2) == 1){
$block = $level->level->getBlock($x, $y, $z);
if($block[1] < 0x07){
//++$this->meta;
//$this->level->setBlock($this, $this, true, false, true);
$level->fastSetBlockUpdate($x, $y, $z, $block[0], $block[1] + 1);
}
}
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() != 60){
@ -40,17 +49,6 @@ class WheatBlock extends FlowableBlock{
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;
}