From db289f9871a77efc860253e2b9367d7476e97024 Mon Sep 17 00:00:00 2001 From: "beN39sGroup (Blue Electric)" Date: Sun, 10 Nov 2013 22:11:45 +0900 Subject: [PATCH] Mixable Lava & Water I Wanna Make Cobblestone Generator! --- src/material/block/liquid/Lava.php | 22 ++++++++++++++++++++++ src/material/block/liquid/Water.php | 25 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/src/material/block/liquid/Lava.php b/src/material/block/liquid/Lava.php index 7d7bc85e..5f38b6d3 100644 --- a/src/material/block/liquid/Lava.php +++ b/src/material/block/liquid/Lava.php @@ -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); diff --git a/src/material/block/liquid/Water.php b/src/material/block/liquid/Water.php index 43137ca3..215978f2 100644 --- a/src/material/block/liquid/Water.php +++ b/src/material/block/liquid/Water.php @@ -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);