diff --git a/src/astarnavigator/TileNavigator.php b/src/astarnavigator/TileNavigator.php index 67077bc7..632e275a 100644 --- a/src/astarnavigator/TileNavigator.php +++ b/src/astarnavigator/TileNavigator.php @@ -62,7 +62,7 @@ class TileNavigator implements ITileNavigator $open->insert($neighbor, -$tentativeG); $has[(string)$neighbor] = true; } - else if ($tentativeG >= $gScore[(string) $neighbor]) + elseif ($tentativeG >= $gScore[(string) $neighbor]) { continue; } diff --git a/src/utils/RailLogic.php b/src/utils/RailLogic.php index 1c277ae6..d64cfdf4 100644 --- a/src/utils/RailLogic.php +++ b/src/utils/RailLogic.php @@ -24,9 +24,9 @@ class RailLogic public function getRail($v){ if(($b = $this->level->getBlock($v)) instanceof RailBaseBlock){ return new RailLogic($b); - }else if(($b = $this->level->getBlockWithoutVector($v->x, $v->y + 1, $v->z)) instanceof RailBaseBlock){ + }elseif(($b = $this->level->getBlockWithoutVector($v->x, $v->y + 1, $v->z)) instanceof RailBaseBlock){ return new RailLogic($b); - }else if(($b = $this->level->getBlockWithoutVector($v->x, $v->y - 1, $v->z)) instanceof RailBaseBlock){ + }elseif(($b = $this->level->getBlockWithoutVector($v->x, $v->y - 1, $v->z)) instanceof RailBaseBlock){ return new RailLogic($b); } @@ -113,10 +113,10 @@ class RailLogic if($state === 0){ if(RailBaseBlock::isRailBlock($this->level, $this->x, $this->y + 1, $this->z - 1)) $state = 4; if(RailBaseBlock::isRailBlock($this->level, $this->x, $this->y + 1, $this->z + 1)) $state = 5; - }else if($state === 1){ + }elseif($state === 1){ if(RailBaseBlock::isRailBlock($this->level, $this->x + 1, $this->y + 1, $this->z)) $state = 2; if(RailBaseBlock::isRailBlock($this->level, $this->x - 1, $this->y + 1, $this->z)) $state = 3; - }else if($state < 0) $state = 0; + }elseif($state < 0) $state = 0; $this->updateConnections($state); $meta = $state; @@ -173,10 +173,10 @@ class RailLogic if($state == 0){ if(RailBaseBlock::isRailBlock($this->level, $this->x, $this->y + 1, $this->z - 1)) $state = 4; if(RailBaseBlock::isRailBlock($this->level, $this->x, $this->y + 1, $this->z + 1)) $state = 5; - }else if($state == 1){ + }elseif($state == 1){ if(RailBaseBlock::isRailBlock($this->level, $this->x + 1, $this->y + 1, $this->z)) $state = 2; if(RailBaseBlock::isRailBlock($this->level, $this->x - 1, $this->y + 1, $this->z)) $state = 3; - }else if($state < 0) $state = 0; + }elseif($state < 0) $state = 0; $meta = $state; diff --git a/src/utils/Utils.php b/src/utils/Utils.php index f2e47a27..3f040820 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -47,7 +47,7 @@ class Utils{ public static function getSeedNumeric($seed){ if($seed === "") return false; - else if(is_int($seed)) return (int)$seed; + elseif(is_int($seed)) return (int)$seed; else{ $i = 0; for($j = 0; $j < strlen($seed); ++$j){ diff --git a/src/world/generator/vanilla/BiomeSource.php b/src/world/generator/vanilla/BiomeSource.php index 106e5914..f511afe1 100644 --- a/src/world/generator/vanilla/BiomeSource.php +++ b/src/world/generator/vanilla/BiomeSource.php @@ -38,7 +38,7 @@ class BiomeSource $f = 1 - (((($this->detailNoises[$index] * 1.1) + 0.5) * 0.01) + ((($this->temperatureNoises[$index] * 0.15) + 0.7) * 0.99)); $f1 = 1 - ($f*$f); if($f1 < 0) $f1 = 0; - else if($f1 > 1) $f1 = 1; + elseif($f1 > 1) $f1 = 1; $this->temperatureNoises[$index++] = $f1; } @@ -66,10 +66,10 @@ class BiomeSource $blockTemp = 1 - ($f1 * $f1); if($blockTemp < 0) $blockTemp = 0; - else if($blockTemp > 1) $blockTemp = 1; + elseif($blockTemp > 1) $blockTemp = 1; if($rain < 0) $rain = 0; - else if($rain > 1) $rain = 1; + elseif($rain > 1) $rain = 1; $this->temperatureNoises[$index] = $blockTemp; $this->rainfallNoises[$index] = $rain; diff --git a/src/world/generator/vanilla/VanillaGenerator.php b/src/world/generator/vanilla/VanillaGenerator.php index 5df25749..dc712a8a 100644 --- a/src/world/generator/vanilla/VanillaGenerator.php +++ b/src/world/generator/vanilla/VanillaGenerator.php @@ -108,12 +108,12 @@ class VanillaGenerator implements LevelGenerator $sample = (int) (((($this->treeNoise->getValue($chunkXWorld * 0.5, $chunkZWorld * 0.5) / 8) + ($this->rand->nextFloat() * 4)) + 4) / 3); $treesAmount = $this->rand->nextInt(10) == 0; if($biome == Biome::$forest) $treesAmount += $sample + 2; - else if($biome == Biome::$rainForest) $treesAmount += $sample + 2; - else if($biome == Biome::$seasonalForest) $treesAmount += $sample + 1; - else if($biome == Biome::$taiga) $treesAmount += $sample + 1; - else if($biome == Biome::$desert) $treesAmount -= 20; - else if($biome == Biome::$tundra) $treesAmount -= 20; - else if($biome == Biome::$plains) $treesAmount -= 20; + elseif($biome == Biome::$rainForest) $treesAmount += $sample + 2; + elseif($biome == Biome::$seasonalForest) $treesAmount += $sample + 1; + elseif($biome == Biome::$taiga) $treesAmount += $sample + 1; + elseif($biome == Biome::$desert) $treesAmount -= 20; + elseif($biome == Biome::$tundra) $treesAmount -= 20; + elseif($biome == Biome::$plains) $treesAmount -= 20; for($l8 = 0; $l8 < $treesAmount; ++$l8){ $l12 = $chunkXWorld + $this->rand->nextInt(16) + 8; $j15 = $chunkZWorld + $this->rand->nextInt(16) + 8; @@ -237,7 +237,7 @@ class VanillaGenerator implements LevelGenerator $b3 = ord($chunks[$blockY >> 4][($blockY & 0xf) + ($blockZ << 5) + ($blockX << 9)]); if($b3 == 0){ $i = -1; - }else if($b3 == STONE){ + }elseif($b3 == STONE){ if($i == -1){ if($nextFloat > 0){ if($blockY >= 64-4 && $blockY <= 64+1){ @@ -266,7 +266,7 @@ class VanillaGenerator implements LevelGenerator }else{ $chunks[$blockY >> 4][($blockY & 0xf) + ($blockZ << 5) + ($blockX << 9)] = chr($b2); } - }else if($i > 0){ + }elseif($i > 0){ --$i; $chunks[$blockY >> 4][($blockY & 0xf) + ($blockZ << 5) + ($blockX << 9)] = chr($b2); if($i == 0 && $b2 == SAND){ @@ -396,7 +396,7 @@ class VanillaGenerator implements LevelGenerator $d12 = ($this->interpolationNoises[$k1] / 10 + 1) / 2; if($d12 < 0) $d8 = $d10; - else if($d12 > 1) $d8 = $d11; + elseif($d12 > 1) $d8 = $d11; else $d8 = $d10 + ($d11 - $d10) * $d12; $d8 -= $d9;