mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 04:29:43 +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
|
|
@ -55,27 +55,30 @@ class SugarcaneBlock extends FlowableBlock{
|
|||
$this->level->setBlock($this, new AirBlock(), false, false, true);
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
}elseif($type === BLOCK_UPDATE_RANDOM){
|
||||
if($this->getSide(0)->getID() !== SUGARCANE_BLOCK){
|
||||
if($this->meta === 0x0F){
|
||||
for($y = 1; $y < 3; ++$y){
|
||||
$b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
|
||||
if($b->getID() === AIR){
|
||||
$this->level->setBlock($b, new SugarcaneBlock(), true, false, true);
|
||||
}
|
||||
}
|
||||
$this->meta = 0;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
}else{
|
||||
++$this->meta;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
}
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function onRandomTick(Level $level, $x, $y, $z){
|
||||
$underID = $level->level->getBlockID($x, $y - 1, $z);
|
||||
$b = $level->level->getBlock($x, $y, $z);
|
||||
$id = $b[0];
|
||||
$meta = $b[1];
|
||||
if($underID !== SUGARCANE_BLOCK){
|
||||
if($meta == 0x0F){
|
||||
for($yy = 1; $yy < 3; ++$yy){
|
||||
$bID = $level->level->getBlockID($x, $y + $yy, $z);
|
||||
if($bID === AIR){
|
||||
$level->setBlock(new Position($x, $y, $z, $level), new SugarcaneBlock(), true, false, true);
|
||||
}
|
||||
}
|
||||
$meta = 0;
|
||||
$level->fastSetBlockUpdate($x, $y, $z, $id, $meta);
|
||||
}else{
|
||||
$level->fastSetBlockUpdate($x, $y, $z, $id, $meta + 1);
|
||||
}
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
}
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === SUGARCANE_BLOCK){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue