Mixable Lava & Water

I Wanna Make Cobblestone Generator!
This commit is contained in:
beN39sGroup (Blue Electric) 2013-11-10 22:11:45 +09:00
parent b822b314cb
commit db289f9871
2 changed files with 47 additions and 0 deletions

View File

@ -49,6 +49,26 @@ class LavaBlock extends LiquidBlock{
return $count;
}
public function checkWater()
{
for($side = 1; $side <= 5; ++$side)
{
$b = $this->getSide($side);
if($b instanceof WaterBlock)
{
$level = $this->meta & 0x07;
if($level == 0x00)
{
$this->level->setBlock($this, new ObsidianBlock(), false, false, true);
}
else
{
$this->level->setBlock($this, new CobblestoneBlock(), false, false, true);
}
}
}
}
public function getFrom()
{
for($side = 0; $side <= 5; ++$side)
@ -75,6 +95,8 @@ class LavaBlock extends LiquidBlock{
return false;
}
if( $this->checkWater() ) { return; }
$falling = $this->meta >> 3;
$down = $this->getSide(0);

View File

@ -49,6 +49,29 @@ class WaterBlock extends LiquidBlock{
return $count;
}
public function checkLava()
{
for($side = 0; $side <= 5; ++$side)
{
if($side == 1) { continue; }
$b = $this->getSide($side);
if($b instanceof LavaBlock)
{
$level = $b->meta & 0x07;
if($level == 0x00)
{
$this->level->setBlock($b, new ObsidianBlock(), false, false, true);
}
else
{
$this->level->setBlock($b, new CobblestoneBlock(), false, false, true);
}
return true;
}
}
return false;
}
public function getFrom()
{
for($side = 0; $side <= 5; ++$side)
@ -75,6 +98,8 @@ class WaterBlock extends LiquidBlock{
return false;
}
$this->checkLava();
$falling = $this->meta >> 3;
$down = $this->getSide(0);