mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19:44 +00:00
bounds for pmflevel methods, random block ticking ported from 0.1.3 core, player height was decreased a bit
This commit is contained in:
parent
84dd0b82b3
commit
3dd9e38a37
22 changed files with 326 additions and 216 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue