From f32f379e971468d1a312217cf05f67cdc31739ff Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sat, 23 Nov 2013 11:04:36 +0100 Subject: [PATCH] Lava flow code reformatting --- src/material/block/liquid/Lava.php | 89 ++++++++++-------------------- 1 file changed, 30 insertions(+), 59 deletions(-) diff --git a/src/material/block/liquid/Lava.php b/src/material/block/liquid/Lava.php index 1dfbb7743..5eb39efa2 100644 --- a/src/material/block/liquid/Lava.php +++ b/src/material/block/liquid/Lava.php @@ -31,17 +31,13 @@ class LavaBlock extends LiquidBlock{ return $ret; } - public function getSourceCount() - { + public function getSourceCount(){ $count = 0; - for($side = 2; $side <= 5; ++$side) - { - if( $this->getSide($side) instanceof LavaBlock ) - { + for($side = 2; $side <= 5; ++$side){ + if($this->getSide($side) instanceof LavaBlock ){ $b = $this->getSide($side); $level = $b->meta & 0x07; - if($level == 0x00) - { + if($level == 0x00){ $count++; } } @@ -49,37 +45,27 @@ class LavaBlock extends LiquidBlock{ return $count; } - public function checkWater() - { - for($side = 1; $side <= 5; ++$side) - { + public function checkWater(){ + for($side = 1; $side <= 5; ++$side){ $b = $this->getSide($side); - if($b instanceof WaterBlock) - { + if($b instanceof WaterBlock){ $level = $this->meta & 0x07; - if($level == 0x00) - { + if($level == 0x00){ $this->level->setBlock($this, new ObsidianBlock(), false, false, true); - } - else - { + }else{ $this->level->setBlock($this, new CobblestoneBlock(), false, false, true); } } } } - public function getFrom() - { - for($side = 0; $side <= 5; ++$side) - { + public function getFrom(){ + for($side = 0; $side <= 5; ++$side){ $b = $this->getSide($side); - if($b instanceof LavaBlock) - { + if($b instanceof LavaBlock){ $tlevel = $b->meta & 0x07; $level = $this->meta & 0x07; - if( ($tlevel + 2) == $level || ($side == 0x01 && $level == 0x01 ) || ($tlevel == 6 && $level == 7 )) - { + if( ($tlevel + 2) == $level || ($side == 0x01 && $level == 0x01 ) || ($tlevel == 6 && $level == 7 )){ return $b; } } @@ -95,66 +81,51 @@ class LavaBlock extends LiquidBlock{ return false; } - if( $this->checkWater() ) { return; } + if( $this->checkWater()){ + return; + } $falling = $this->meta >> 3; $down = $this->getSide(0); $from = $this->getFrom(); - //출처가 있거나 이 자체가 출처이면 - if($from !== null || $level == 0x00) - { - if($level !== 0x07) - { - if($down instanceof AirBlock || $down instanceof LavaBlock) - { + if($from !== null || $level == 0x00){ + if($level !== 0x07){ + if($down instanceof AirBlock || $down instanceof LavaBlock){ $this->level->setBlock($down, new LavaBlock(0x01), false, false, true); ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($down, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL); - } - else - { - for($side = 2; $side <= 5; ++$side) - { + }else{ + for($side = 2; $side <= 5; ++$side){ $b = $this->getSide($side); - if($b instanceof LavaBlock) - { + if($b instanceof LavaBlock){ - } - else if($b->isFlowable === true) - { + }else if($b->isFlowable === true){ $this->level->setBlock($b, new LavaBlock( min($level + 2,7) ), false, false, true); ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL); } } } } - } - else - { + }else{ //Extend Remove for Left Lavas - for($side = 2; $side <= 5; ++$side) - { + for($side = 2; $side <= 5; ++$side){ $sb = $this->getSide($side); - if($sb instanceof LavaBlock) - { + if($sb instanceof LavaBlock){ $tlevel = $sb->meta & 0x07; - if($tlevel != 0x00) - { + if($tlevel != 0x00){ $this->level->setBlock($sb, new AirBlock(), false, false, true); } } $b = $this->getSide(0)->getSide($side); - if($b instanceof LavaBlock) - { + if($b instanceof LavaBlock){ $tlevel = $b->meta & 0x07; - if($tlevel != 0x00) - { + if($tlevel != 0x00){ $this->level->setBlock($b, new AirBlock(), false, false, true); } } //ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 10, BLOCK_UPDATE_NORMAL); } - //출처가 제거된 경우 이 블록 제거 + $this->level->setBlock($this, new AirBlock(), false, false, true); } return false;