mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
fixed sapling growth & sugarcane
This commit is contained in:
parent
6d1d7cb8a5
commit
83dad024b1
4 changed files with 16 additions and 17 deletions
|
|
@ -47,22 +47,21 @@ class SaplingBlock extends FlowableBlock{
|
|||
$this->level->setBlock($this, new AirBlock(), false, false, true);
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
}elseif($type === BLOCK_UPDATE_RANDOM){ //Growth
|
||||
if(mt_rand(1,7) === 1){
|
||||
if(($this->meta & 0x08) === 0x08){
|
||||
TreeObject::growTree($this->level, $this, new Random(), $this->meta & 0x03);
|
||||
}else{
|
||||
$this->meta |= 0x08;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
}else{
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function onRandomTick(Level $level, $x, $y, $z){
|
||||
if(mt_rand(1,7) === 1){
|
||||
$meta = $level->level->getBlockDamage($x, $y, $z);
|
||||
if(($meta & 0x08) === 0x08){
|
||||
TreeObject::growTree($level, new Vector3($x, $y, $z), new Random(), $meta & 0x03);
|
||||
}else{
|
||||
$meta |= 0x08;
|
||||
$level->fastSetBlockUpdate($x, $y, $z, SAPLING, $meta);
|
||||
//$level->setBlock($this, $this, true, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, $this->meta & 0x03, 1),
|
||||
|
|
|
|||
|
|
@ -64,11 +64,12 @@ class SugarcaneBlock extends FlowableBlock{
|
|||
$id = $b[0];
|
||||
$meta = $b[1];
|
||||
if($underID !== SUGARCANE_BLOCK){
|
||||
if($meta == 0x0F){
|
||||
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);
|
||||
//$level->setBlock(new Position($x, $y, $z, $level), new SugarcaneBlock(), true, false, true);
|
||||
$level->fastSetBlockUpdate($x, $y + $yy, $z, SUGARCANE_BLOCK, 0);
|
||||
}
|
||||
}
|
||||
$meta = 0;
|
||||
|
|
@ -76,7 +77,6 @@ class SugarcaneBlock extends FlowableBlock{
|
|||
}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){
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ abstract class ProtocolInfo{
|
|||
}
|
||||
/*Unused:
|
||||
* 0xb5
|
||||
* 0xb9
|
||||
* 0x96
|
||||
* 0x17
|
||||
* 0x14
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class Level{
|
|||
FARMLAND => true,
|
||||
GLOWING_REDSTONE_ORE => true,
|
||||
BEETROOT_BLOCK => true,
|
||||
SAPLING => true,
|
||||
CACTUS => true,
|
||||
CARROT_BLOCK => true,
|
||||
MELON_STEM => true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue