mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 04:59:46 +00:00
syntax xd
This commit is contained in:
parent
58626eeb95
commit
84dd0b82b3
5 changed files with 20 additions and 20 deletions
|
|
@ -62,7 +62,7 @@ class TileNavigator implements ITileNavigator
|
||||||
$open->insert($neighbor, -$tentativeG);
|
$open->insert($neighbor, -$tentativeG);
|
||||||
$has[(string)$neighbor] = true;
|
$has[(string)$neighbor] = true;
|
||||||
}
|
}
|
||||||
else if ($tentativeG >= $gScore[(string) $neighbor])
|
elseif ($tentativeG >= $gScore[(string) $neighbor])
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,9 @@ class RailLogic
|
||||||
public function getRail($v){
|
public function getRail($v){
|
||||||
if(($b = $this->level->getBlock($v)) instanceof RailBaseBlock){
|
if(($b = $this->level->getBlock($v)) instanceof RailBaseBlock){
|
||||||
return new RailLogic($b);
|
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);
|
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);
|
return new RailLogic($b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,10 +113,10 @@ class RailLogic
|
||||||
if($state === 0){
|
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 = 4;
|
||||||
if(RailBaseBlock::isRailBlock($this->level, $this->x, $this->y + 1, $this->z + 1)) $state = 5;
|
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 = 2;
|
||||||
if(RailBaseBlock::isRailBlock($this->level, $this->x - 1, $this->y + 1, $this->z)) $state = 3;
|
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);
|
$this->updateConnections($state);
|
||||||
$meta = $state;
|
$meta = $state;
|
||||||
|
|
@ -173,10 +173,10 @@ class RailLogic
|
||||||
if($state == 0){
|
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 = 4;
|
||||||
if(RailBaseBlock::isRailBlock($this->level, $this->x, $this->y + 1, $this->z + 1)) $state = 5;
|
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 = 2;
|
||||||
if(RailBaseBlock::isRailBlock($this->level, $this->x - 1, $this->y + 1, $this->z)) $state = 3;
|
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;
|
$meta = $state;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class Utils{
|
||||||
|
|
||||||
public static function getSeedNumeric($seed){
|
public static function getSeedNumeric($seed){
|
||||||
if($seed === "") return false;
|
if($seed === "") return false;
|
||||||
else if(is_int($seed)) return (int)$seed;
|
elseif(is_int($seed)) return (int)$seed;
|
||||||
else{
|
else{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
for($j = 0; $j < strlen($seed); ++$j){
|
for($j = 0; $j < strlen($seed); ++$j){
|
||||||
|
|
|
||||||
|
|
@ -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));
|
$f = 1 - (((($this->detailNoises[$index] * 1.1) + 0.5) * 0.01) + ((($this->temperatureNoises[$index] * 0.15) + 0.7) * 0.99));
|
||||||
$f1 = 1 - ($f*$f);
|
$f1 = 1 - ($f*$f);
|
||||||
if($f1 < 0) $f1 = 0;
|
if($f1 < 0) $f1 = 0;
|
||||||
else if($f1 > 1) $f1 = 1;
|
elseif($f1 > 1) $f1 = 1;
|
||||||
|
|
||||||
$this->temperatureNoises[$index++] = $f1;
|
$this->temperatureNoises[$index++] = $f1;
|
||||||
}
|
}
|
||||||
|
|
@ -66,10 +66,10 @@ class BiomeSource
|
||||||
$blockTemp = 1 - ($f1 * $f1);
|
$blockTemp = 1 - ($f1 * $f1);
|
||||||
|
|
||||||
if($blockTemp < 0) $blockTemp = 0;
|
if($blockTemp < 0) $blockTemp = 0;
|
||||||
else if($blockTemp > 1) $blockTemp = 1;
|
elseif($blockTemp > 1) $blockTemp = 1;
|
||||||
|
|
||||||
if($rain < 0) $rain = 0;
|
if($rain < 0) $rain = 0;
|
||||||
else if($rain > 1) $rain = 1;
|
elseif($rain > 1) $rain = 1;
|
||||||
|
|
||||||
$this->temperatureNoises[$index] = $blockTemp;
|
$this->temperatureNoises[$index] = $blockTemp;
|
||||||
$this->rainfallNoises[$index] = $rain;
|
$this->rainfallNoises[$index] = $rain;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
$sample = (int) (((($this->treeNoise->getValue($chunkXWorld * 0.5, $chunkZWorld * 0.5) / 8) + ($this->rand->nextFloat() * 4)) + 4) / 3);
|
||||||
$treesAmount = $this->rand->nextInt(10) == 0;
|
$treesAmount = $this->rand->nextInt(10) == 0;
|
||||||
if($biome == Biome::$forest) $treesAmount += $sample + 2;
|
if($biome == Biome::$forest) $treesAmount += $sample + 2;
|
||||||
else if($biome == Biome::$rainForest) $treesAmount += $sample + 2;
|
elseif($biome == Biome::$rainForest) $treesAmount += $sample + 2;
|
||||||
else if($biome == Biome::$seasonalForest) $treesAmount += $sample + 1;
|
elseif($biome == Biome::$seasonalForest) $treesAmount += $sample + 1;
|
||||||
else if($biome == Biome::$taiga) $treesAmount += $sample + 1;
|
elseif($biome == Biome::$taiga) $treesAmount += $sample + 1;
|
||||||
else if($biome == Biome::$desert) $treesAmount -= 20;
|
elseif($biome == Biome::$desert) $treesAmount -= 20;
|
||||||
else if($biome == Biome::$tundra) $treesAmount -= 20;
|
elseif($biome == Biome::$tundra) $treesAmount -= 20;
|
||||||
else if($biome == Biome::$plains) $treesAmount -= 20;
|
elseif($biome == Biome::$plains) $treesAmount -= 20;
|
||||||
for($l8 = 0; $l8 < $treesAmount; ++$l8){
|
for($l8 = 0; $l8 < $treesAmount; ++$l8){
|
||||||
$l12 = $chunkXWorld + $this->rand->nextInt(16) + 8;
|
$l12 = $chunkXWorld + $this->rand->nextInt(16) + 8;
|
||||||
$j15 = $chunkZWorld + $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)]);
|
$b3 = ord($chunks[$blockY >> 4][($blockY & 0xf) + ($blockZ << 5) + ($blockX << 9)]);
|
||||||
if($b3 == 0){
|
if($b3 == 0){
|
||||||
$i = -1;
|
$i = -1;
|
||||||
}else if($b3 == STONE){
|
}elseif($b3 == STONE){
|
||||||
if($i == -1){
|
if($i == -1){
|
||||||
if($nextFloat > 0){
|
if($nextFloat > 0){
|
||||||
if($blockY >= 64-4 && $blockY <= 64+1){
|
if($blockY >= 64-4 && $blockY <= 64+1){
|
||||||
|
|
@ -266,7 +266,7 @@ class VanillaGenerator implements LevelGenerator
|
||||||
}else{
|
}else{
|
||||||
$chunks[$blockY >> 4][($blockY & 0xf) + ($blockZ << 5) + ($blockX << 9)] = chr($b2);
|
$chunks[$blockY >> 4][($blockY & 0xf) + ($blockZ << 5) + ($blockX << 9)] = chr($b2);
|
||||||
}
|
}
|
||||||
}else if($i > 0){
|
}elseif($i > 0){
|
||||||
--$i;
|
--$i;
|
||||||
$chunks[$blockY >> 4][($blockY & 0xf) + ($blockZ << 5) + ($blockX << 9)] = chr($b2);
|
$chunks[$blockY >> 4][($blockY & 0xf) + ($blockZ << 5) + ($blockX << 9)] = chr($b2);
|
||||||
if($i == 0 && $b2 == SAND){
|
if($i == 0 && $b2 == SAND){
|
||||||
|
|
@ -396,7 +396,7 @@ class VanillaGenerator implements LevelGenerator
|
||||||
$d12 = ($this->interpolationNoises[$k1] / 10 + 1) / 2;
|
$d12 = ($this->interpolationNoises[$k1] / 10 + 1) / 2;
|
||||||
|
|
||||||
if($d12 < 0) $d8 = $d10;
|
if($d12 < 0) $d8 = $d10;
|
||||||
else if($d12 > 1) $d8 = $d11;
|
elseif($d12 > 1) $d8 = $d11;
|
||||||
else $d8 = $d10 + ($d11 - $d10) * $d12;
|
else $d8 = $d10 + ($d11 - $d10) * $d12;
|
||||||
|
|
||||||
$d8 -= $d9;
|
$d8 -= $d9;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue