1
0
Fork 1

Fixing formating (again)

Dieser Commit ist enthalten in:
Ad5001 2017-05-13 23:42:44 +02:00
Ursprung be6965b909
Commit 668cc0de55
12 geänderte Dateien mit 142 neuen und 137 gelöschten Zeilen

Datei anzeigen

@ -107,62 +107,62 @@ class Main extends PluginBase implements Listener {
return false;
break;
case 1 : // /createworld <name>
$name = $args [0];
$name = $args[0];
$generator = Generator::getGenerator("betternormal");
$generatorName = "betternormal";
$seed = $this->generateRandomSeed();
$options = [];
break;
case 2 : // /createworld <name> [generator = betternormal]
$name = $args [0];
$generator = Generator::getGenerator($args [1]);
if (Generator::getGeneratorName($generator) !== strtolower($args [1])) {
$name = $args[0];
$generator = Generator::getGenerator($args[1]);
if (Generator::getGeneratorName($generator) !== strtolower($args[1])) {
$sender->sendMessage(self::PREFIX . "§4Could not find generator {$args[1]}. Are you sure it is registered?");
return true;
}
$generatorName = strtolower($args [1]);
$generatorName = strtolower($args[1]);
$seed = $this->generateRandomSeed();
$options = [];
break;
case 3 : // /createworld <name> [generator = betternormal] [seed = rand()]
$name = $args [0];
$generator = Generator::getGenerator($args [1]);
if (Generator::getGeneratorName($generator) !== strtolower($args [1])) {
$name = $args[0];
$generator = Generator::getGenerator($args[1]);
if (Generator::getGeneratorName($generator) !== strtolower($args[1])) {
$sender->sendMessage(self::PREFIX . "§4Could not find generator {$args[1]}. Are you sure it is registered?");
return true;
}
$generatorName = strtolower($args [1]);
if (preg_match("[^\d]", $args [2]) !== false) {
$parts = str_split($args [2]);
$generatorName = strtolower($args[1]);
if (preg_match("[^\d]", $args[2]) !== false) {
$parts = str_split($args[2]);
foreach ($parts as $key => $str) {
$parts [$key] = ord($str);
$parts[$key] = ord($str);
}
$seed = implode("", $parts);
} else {
$seed = $args [2];
$seed = $args[2];
}
$options = [];
break;
default : // /createworld <name> [generator = betternormal] [seed = rand()] [options(json)]
$name = $args [0];
$generator = Generator::getGenerator($args [1]);
if (Generator::getGeneratorName($generator) !== strtolower($args [1])) {
$name = $args[0];
$generator = Generator::getGenerator($args[1]);
if (Generator::getGeneratorName($generator) !== strtolower($args[1])) {
$sender->sendMessage(self::PREFIX . "§4Could not find generator {$args[1]}. Are you sure it is registered?");
return true;
}
$generatorName = strtolower($args [1]);
$generatorName = strtolower($args[1]);
if ($args[2] == "rand") $args[2] = $this->generateRandomSeed();
if (preg_match("[^\d]", $args [2]) !== false) {
$parts = str_split($args [2]);
if (preg_match("[^\d]", $args[2]) !== false) {
$parts = str_split($args[2]);
foreach ($parts as $key => $str) {
$parts [$key] = ord($str);
$parts[$key] = ord($str);
}
$seed = implode("", $parts);
} else {
$seed = $args [2];
$seed = $args[2];
}
unset($args [0], $args [1], $args [2]);
$options = json_decode($args [3], true);
unset($args[0], $args[1], $args[2]);
$options = json_decode($args[3], true);
if (!is_array($options)) {
$sender->sendMessage(Main::PREFIX . "§4Invalid JSON for options.");
return true;
@ -227,7 +227,7 @@ class Main extends PluginBase implements Listener {
return false;
if (!@is_subclass_of($treeClass, "pocketmine\\level\\generator\\normal\\object\\Tree"))
return false;
if (count($infos) < 2 or !is_float($infos [0]) or !is_float($infos [1]))
if (count($infos) < 2 or !is_float($infos[0]) or !is_float($infos[1]))
return false;
return BetterForest::registerForest($name, $treeClass, $infos);
}

Datei anzeigen

@ -50,7 +50,7 @@ class BetterForest extends ForestBiome implements Mountainable {
$this->addPopulator($ft);
$trees = new TreePopulator($type);
$trees->setBaseAmount((null !== @constant(TreePopulator::$types [$type] . "::maxPerChunk")) ? constant(TreePopulator::$types [$type] . "::maxPerChunk") : 5);
$trees->setBaseAmount((null !== @constant(TreePopulator::$types[$type] . "::maxPerChunk")) ? constant(TreePopulator::$types[$type] . "::maxPerChunk") : 5);
$this->addPopulator($trees);
$tallGrass = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\TallGrass () : new \pocketmine\level\generator\populator\TallGrass();
@ -60,8 +60,8 @@ class BetterForest extends ForestBiome implements Mountainable {
$this->setElevation(63, 69);
$this->temperature = $infos [0];
$this->rainfall = $infos [1];
$this->temperature = $infos[0];
$this->rainfall = $infos[1];
}
public function getName() {
return str_ireplace(" ", "", self::$types[$this->type]);
@ -72,7 +72,7 @@ class BetterForest extends ForestBiome implements Mountainable {
* @return int
*/
public function getId() {
return self::$ids [$this->type];
return self::$ids[$this->type];
}
/**
* @param string $name
@ -81,9 +81,9 @@ class BetterForest extends ForestBiome implements Mountainable {
* @return bool
*/
public static function registerForest(string $name, string $treeClass, array $infos): bool {
self::$types [] = str_ireplace("tree", "", explode("\\", $treeClass) [count(explode("\\", $treeClass))]) . " Forest";
TreePopulator::$types [] = $treeClass;
self::$ids [] = Main::SAKURA_FOREST + (count(self::$types) - 2);
self::$types[] = str_ireplace("tree", "", explode("\\", $treeClass)[count(explode("\\", $treeClass))]) . " Forest";
TreePopulator::$types[] = $treeClass;
self::$ids[] = Main::SAKURA_FOREST + (count(self::$types) - 2);
Main::register(Main::SAKURA_FOREST + (count(self::$types) - 2), new BetterForest(count(self::$types) - 1, $infos));
return true;
}

Datei anzeigen

@ -41,7 +41,7 @@ class BetterBiomeSelector extends BiomeSelector {
public function recalculate() {
} // Using our own system, No need for that
public function addBiome(Biome $biome) {
$this->biomes [$biome->getId ()] = $biome;
$this->biomes[$biome->getId ()] = $biome;
}
public function getTemperature($x, $z) {
return ($this->temperature->noise2D($x, $z, true) + 1) / 2;
@ -64,7 +64,7 @@ class BetterBiomeSelector extends BiomeSelector {
$rainfall = ($this->getRainfall($x, $z));
$biomeId = BetterNormal::getBiome($temperature, $rainfall);
$b = (($biomeId instanceof Biome) ? $biomeId : ($this->biomes [$biomeId] ?? $this->fallback));
$b = (($biomeId instanceof Biome) ? $biomeId : ($this->biomes[$biomeId] ?? $this->fallback));
return $b;
}
}

Datei anzeigen

@ -74,7 +74,10 @@ class BetterNormal extends Generator {
protected static $GAUSSIAN_KERNEL = null; // From main class
protected static $SMOOTH_SIZE = 2;
protected static $options = [
"deleteBiomes" => [
"delBio" => [
],
"delStruct" => [
"Lakes"
]
];
protected $waterHeight = 63;
@ -116,7 +119,7 @@ class BetterNormal extends Generator {
$this->level = $level;
$this->random = $random;
self::$levels [] = $level;
self::$levels[] = $level;
$this->random->setSeed($this->level->getSeed ());
$this->noiseBase = new Simplex($this->random, 4, 1 / 4, 1 / 32);
@ -158,57 +161,57 @@ class BetterNormal extends Generator {
$this->selector->recalculate ();
$cover = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\GroundCover() : new \pocketmine\level\generator\populator\GroundCover();
$this->generationPopulators [] = $cover;
$this->generationPopulators[] = $cover;
// https://twitter.com/Ad5001P4F/status/859430935468670976
// $lake = new LakePopulator ();
// $lake->setBaseAmount(0);
// $lake->setRandomAmount(1);
// $this->generationPopulators [] = $lake;
$cave = new CavePopulator ();
$cave->setBaseAmount(0);
$cave->setRandomAmount(2);
$this->generationPopulators [] = $cave;
$ravine = new RavinePopulator ();
$ravine->setBaseAmount(0);
$ravine->setRandomAmount(51);
$this->generationPopulators [] = $ravine;
$mineshaft = new MineshaftPopulator ();
$mineshaft->setBaseAmount(0);
$mineshaft->setRandomAmount(102);
$this->populators [] = $mineshaft;
if() {
$lake = new LakePopulator();
$lake->setBaseAmount(0);
$lake->setRandomAmount(1);
$this->generationPopulators[] = $lake;
$fisl = new FloatingIslandPopulator();
$fisl->setBaseAmount(0);
$fisl->setRandomAmount(132);
$this->populators [] = $fisl;
$ores = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\Ore() : new \pocketmine\level\generator\populator\Ore();
if(Main::isOtherNS()) $ores->setOreTypes([
new OreType2(new CoalOre (), 20, 16, 0, 128),
new OreType2(new IronOre (), 20, 8, 0, 64),
new OreType2(new RedstoneOre (), 8, 7, 0, 16),
new OreType2(new LapisOre (), 1, 6, 0, 32),
new OreType2(new GoldOre (), 2, 8, 0, 32),
new OreType2(new DiamondOre (), 1, 7, 0, 16),
new OreType2(new Dirt (), 20, 32, 0, 128),
new OreType2(new Gravel (), 10, 16, 0, 128)
]);
if(!Main::isOtherNS()) $ores->setOreTypes([
new OreType(new CoalOre (), 20, 16, 0, 128),
new OreType(new IronOre (), 20, 8, 0, 64),
new OreType(new RedstoneOre (), 8, 7, 0, 16),
new OreType(new LapisOre (), 1, 6, 0, 32),
new OreType(new GoldOre (), 2, 8, 0, 32),
new OreType(new DiamondOre (), 1, 7, 0, 16),
new OreType(new Dirt (), 20, 32, 0, 128),
new OreType(new Gravel (), 10, 16, 0, 128)
]);
$this->populators [] = $ores;
$cave = new CavePopulator ();
$cave->setBaseAmount(0);
$cave->setRandomAmount(2);
$this->generationPopulators[] = $cave;
$ravine = new RavinePopulator ();
$ravine->setBaseAmount(0);
$ravine->setRandomAmount(51);
$this->generationPopulators[] = $ravine;
$mineshaft = new MineshaftPopulator ();
$mineshaft->setBaseAmount(0);
$mineshaft->setRandomAmount(102);
$this->populators[] = $mineshaft;
$fisl = new FloatingIslandPopulator();
$fisl->setBaseAmount(0);
$fisl->setRandomAmount(132);
$this->populators[] = $fisl;
$ores = Main::isOtherNS() ? new \pocketmine\level\generator\normal\populator\Ore() : new \pocketmine\level\generator\populator\Ore();
if(Main::isOtherNS()) $ores->setOreTypes([
new OreType2(new CoalOre (), 20, 16, 0, 128),
new OreType2(new IronOre (), 20, 8, 0, 64),
new OreType2(new RedstoneOre (), 8, 7, 0, 16),
new OreType2(new LapisOre (), 1, 6, 0, 32),
new OreType2(new GoldOre (), 2, 8, 0, 32),
new OreType2(new DiamondOre (), 1, 7, 0, 16),
new OreType2(new Dirt (), 20, 32, 0, 128),
new OreType2(new Gravel (), 10, 16, 0, 128)
]);
if(!Main::isOtherNS()) $ores->setOreTypes([
new OreType(new CoalOre (), 20, 16, 0, 128),
new OreType(new IronOre (), 20, 8, 0, 64),
new OreType(new RedstoneOre (), 8, 7, 0, 16),
new OreType(new LapisOre (), 1, 6, 0, 32),
new OreType(new GoldOre (), 2, 8, 0, 32),
new OreType(new DiamondOre (), 1, 7, 0, 16),
new OreType(new Dirt (), 20, 32, 0, 128),
new OreType(new Gravel (), 10, 16, 0, 128)
]);
$this->populators[] = $ores;
}
/*
@ -217,13 +220,13 @@ class BetterNormal extends Generator {
* @return bool
*/
public static function registerBiome(Biome $biome): bool {
if(\Ad5001\BetterGen\utils\CommonUtils::in_arrayi($biome->getName(), self::$options["deleteBiomes"])) {
if(\Ad5001\BetterGen\utils\CommonUtils::in_arrayi($biome->getName(), self::$options["delBio"])) {
return false;
}
foreach(self::$levels as $lvl) if(isset($lvl->selector)) $lvl->selector->addBiome($biome); // If no selector created, it would cause errors. These will be added when selectoes
if (! isset(self::$biomes[(string) $biome->getRainfall ()])) self::$biomes [( string) $biome->getRainfall ()] = [ ];
self::$biomes [( string) $biome->getRainfall ()] [( string) $biome->getTemperature ()] = $biome;
ksort(self::$biomes [( string) $biome->getRainfall ()]);
if (! isset(self::$biomes[(string) $biome->getRainfall ()])) self::$biomes[( string) $biome->getRainfall ()] = [ ];
self::$biomes[( string) $biome->getRainfall ()] [( string) $biome->getTemperature ()] = $biome;
ksort(self::$biomes[( string) $biome->getRainfall ()]);
ksort(self::$biomes);
self::$biomeById[$biome->getId()] = $biome;
return true;
@ -236,8 +239,8 @@ class BetterNormal extends Generator {
*/
public static function getBiome($temperature, $rainfall) {
$ret = null;
if (! isset(self::$biomes [( string) round($rainfall, 1)])) {
while(! isset(self::$biomes [( string) round($rainfall, 1)])) {
if (! isset(self::$biomes[( string) round($rainfall, 1)])) {
while(! isset(self::$biomes[( string) round($rainfall, 1)])) {
if (abs($rainfall - round($rainfall, 1)) >= 0.05)
$rainfall += 0.1;
if (abs($rainfall - round($rainfall, 1)) < 0.05)
@ -248,7 +251,7 @@ class BetterNormal extends Generator {
$rainfall = 0.9;
}
}
$b = self::$biomes [( string) round($rainfall, 1)];
$b = self::$biomes[( string) round($rainfall, 1)];
foreach($b as $t => $biome) {
if ($temperature <=(float) $t) {
$ret = $biome;
@ -298,16 +301,16 @@ class BetterNormal extends Generator {
for($sx = - self::$SMOOTH_SIZE; $sx <= self::$SMOOTH_SIZE; $sx++) {
for($sz = - self::$SMOOTH_SIZE; $sz <= self::$SMOOTH_SIZE; $sz++) {
$weight = self::$GAUSSIAN_KERNEL [$sx + self::$SMOOTH_SIZE] [$sz + self::$SMOOTH_SIZE];
$weight = self::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE] [$sz + self::$SMOOTH_SIZE];
if ($sx === 0 and $sz === 0) {
$adjacent = $biome;
} else {
$index = Level::chunkHash($chunkX * 16 + $x + $sx, $chunkZ * 16 + $z + $sz);
if (isset($biomeCache [$index])) {
$adjacent = $biomeCache [$index];
if (isset($biomeCache[$index])) {
$adjacent = $biomeCache[$index];
} else {
$biomeCache [$index] = $adjacent = $this->pickBiome($chunkX * 16 + $x + $sx, $chunkZ * 16 + $z + $sz);
$biomeCache[$index] = $adjacent = $this->pickBiome($chunkX * 16 + $x + $sx, $chunkZ * 16 + $z + $sz);
}
}
$minSum += ($adjacent->getMinElevation () - 1) * $weight;
@ -327,7 +330,7 @@ class BetterNormal extends Generator {
$chunk->setBlockId($x, $y, $z, Block::BEDROCK);
continue;
}
$noiseValue = $noise [$x] [$z] [$y] - 1 / $smoothHeight * ($y - $smoothHeight - $minSum);
$noiseValue = $noise[$x] [$z] [$y] - 1 / $smoothHeight * ($y - $smoothHeight - $minSum);
if ($noiseValue > 0) {
$chunk->setBlockId($x, $y, $z, Block::STONE);
@ -374,15 +377,17 @@ class BetterNormal extends Generator {
public function __construct(array $options = []) {
self::$options["preset"] = $options["preset"];
$options = (array) json_decode($options["preset"]);
if(isset($options["deleteBiomes"]) && is_string($options["deleteBiomes"])) {
$options["deleteBiomes"] = explode(",", $options["deleteBiomes"]);
if(count($options["deleteBiomes"]) !== 0) {
self::$options["deleteBiomes"] = $options["deleteBiomes"];
if(isset($options["delBio"])) {
if(is_string($options["de"])) $options["delBio"] = explode(",", $options["delBio"]);
if(count($options["delBio"]) !== 0) {
self::$options["delBio"] = $options["delBio"];
}
}
if(isset($options["deleteBiomes"]) && count($options["deleteBiomes"]) !== 0) {
self::$options["deleteBiomes"] = $options["deleteBiomes"];
if(isset($options["delStruct"])) {
if(is_string($options["delStruct"])) $options["delStruct"] = explode(",", $options["delStruct"]);
if(count($options["delStruct"]) !== 0) {
self::$options["delStruct"] = $options["delStruct"];
}
}
if (self::$GAUSSIAN_KERNEL === null) {
self::generateKernel ();
@ -399,12 +404,12 @@ class BetterNormal extends Generator {
$bellHeight = 2 * self::$SMOOTH_SIZE;
for($sx = - self::$SMOOTH_SIZE; $sx <= self::$SMOOTH_SIZE; $sx++) {
self::$GAUSSIAN_KERNEL [$sx + self::$SMOOTH_SIZE] = [ ];
self::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE] = [ ];
for($sz = - self::$SMOOTH_SIZE; $sz <= self::$SMOOTH_SIZE; $sz++) {
$bx = $bellSize * $sx;
$bz = $bellSize * $sz;
self::$GAUSSIAN_KERNEL [$sx + self::$SMOOTH_SIZE] [$sz + self::$SMOOTH_SIZE] = $bellHeight * exp(- ($bx * $bx + $bz * $bz) / 2);
self::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE] [$sz + self::$SMOOTH_SIZE] = $bellHeight * exp(- ($bx * $bx + $bz * $bz) / 2);
}
}
}

Datei anzeigen

@ -271,19 +271,19 @@ class MineshaftPopulator extends AmountPopulator {
switch ($dir) {
case self::DIR_XPLUS :
$x ++;
unset($possiblePathes [0]);
unset($possiblePathes[0]);
break;
case self::DIR_XMIN :
$x --;
unset($possiblePathes [1]);
unset($possiblePathes[1]);
break;
case self::DIR_ZPLUS :
$z ++;
unset($possiblePathes [2]);
unset($possiblePathes[2]);
break;
case self::DIR_ZMIN :
$z --;
unset($possiblePathes [3]);
unset($possiblePathes[3]);
break;
}
@ -303,7 +303,7 @@ class MineshaftPopulator extends AmountPopulator {
$numberFloor = $random->nextBoundedInt(4 + ($newFloor ? 5 : 0));
$possiblePathes = [
$possiblePathes,
($newFloor ? [
($newFloor ?[
self::DIR_XPLUS,
self::DIR_XMIN,
self::DIR_ZPLUS,
@ -313,10 +313,10 @@ class MineshaftPopulator extends AmountPopulator {
for($i = 7; $i > $newFloor; $i --) {
$chooseNew =(int) $newFloor && $random->nextBoolean ();
$choose = $random->nextBoundedInt(4);
unset($possiblePathes [$chooseNew] [$choose]);
unset($possiblePathes[$chooseNew] [$choose]);
}
// Building pathes
foreach($possiblePathes [0] as $path) {
foreach($possiblePathes[0] as $path) {
switch ($path) {
case self::DIR_XPLUS :
$this->generateMineshaftPart($x + 2, $y, $z, self::DIR_XPLUS, $random);
@ -332,7 +332,7 @@ class MineshaftPopulator extends AmountPopulator {
break;
}
}
foreach($possiblePathes [1] as $path) {
foreach($possiblePathes[1] as $path) {
switch ($path) {
case self::DIR_XPLUS :
$this->generateMineshaftPart($x + 2, $y + 4, $z, self::DIR_XPLUS, $random);

Datei anzeigen

@ -64,7 +64,7 @@ class TreePopulator extends AmountPopulator {
if ($y === -1) {
continue;
}
$treeC = self::$types [$this->type];
$treeC = self::$types[$this->type];
/** @var Tree $tree */
$tree = new $treeC();
$tree->placeObject($level, $x, $y, $z, $random);

Datei anzeigen

@ -72,9 +72,9 @@ class Bush extends Object {
* @param $level pocketmine\level\ChunkManager
*/
public function placeLeaf($x, $y, $z, ChunkManager $level) {
if (isset($this->overridable [$level->getBlockIdAt($x, $y, $z)]) && ! isset($this->overridable [$level->getBlockIdAt($x, $y - 1, $z)])) {
$level->setBlockIdAt($x, $y, $z, $this->leaf [0]);
$level->setBlockDataAt($x, $y, $z, $this->leaf [1]);
if (isset($this->overridable[$level->getBlockIdAt($x, $y, $z)]) && ! isset($this->overridable[$level->getBlockIdAt($x, $y - 1, $z)])) {
$level->setBlockIdAt($x, $y, $z, $this->leaf[0]);
$level->setBlockDataAt($x, $y, $z, $this->leaf[1]);
}
}
}

Datei anzeigen

@ -155,9 +155,9 @@ class FallenTree extends Object {
* @param $level pocketmine\level\ChunkManager
*/
public function placeBlock($x, $y, $z, ChunkManager $level) {
if (isset(self::$overridable [$level->getBlockIdAt($x, $y, $z)]) && ! isset(self::$overridable [$level->getBlockIdAt($x, $y - 1, $z)])) {
$level->setBlockIdAt($x, $y, $z, $this->trunk [0]);
$level->setBlockDataAt($x, $y, $z, $this->trunk [1]);
if (isset(self::$overridable[$level->getBlockIdAt($x, $y, $z)]) && ! isset(self::$overridable[$level->getBlockIdAt($x, $y - 1, $z)])) {
$level->setBlockIdAt($x, $y, $z, $this->trunk[0]);
$level->setBlockDataAt($x, $y, $z, $this->trunk[1]);
}
}
}

Datei anzeigen

@ -49,28 +49,28 @@ class Igloo extends Object {
for($xx = $x - 3; $xx <= $x + 4; $xx ++)
for($yy = $y + 1; $yy <= $y + 4; $yy ++)
for($zz = $z - 3; $zz <= $z + 3; $zz ++)
if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz)]))
if (! isset($this->overridable[$level->getBlockIdAt($xx, $yy, $zz)]))
return false;
break;
case 1 : // Entrance is x-
for($xx = $x - 4; $xx <= $x + 3; $xx ++)
for($yy = $y + 1; $yy <= $y + 4; $yy ++)
for($zz = $z - 3; $zz <= $z + 3; $zz ++)
if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz)]))
if (! isset($this->overridable[$level->getBlockIdAt($xx, $yy, $zz)]))
return false;
break;
case 2 : // Entrance is z+
for($xx = $x - 3; $xx <= $x + 3; $xx ++)
for($yy = $y + 1; $yy <= $y + 4; $yy ++)
for($zz = $z - 3; $zz <= $z + 4; $zz ++)
if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz)]))
if (! isset($this->overridable[$level->getBlockIdAt($xx, $yy, $zz)]))
return false;
break;
case 3 : // Entrance is z-
for($xx = $x - 3; $xx <= $x + 3; $xx ++)
for($yy = $y + 1; $yy <= $y + 4; $yy ++)
for($zz = $z - 4; $zz <= $z + 3; $zz ++)
if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz)]))
if (! isset($this->overridable[$level->getBlockIdAt($xx, $yy, $zz)]))
return false;
break;
}
@ -94,7 +94,7 @@ class Igloo extends Object {
// Ground
for($xx = $x - 3; $xx <= $x + 4; $xx ++)
for($zz = $z - 3; $zz <= $z + 3; $zz ++)
if (! isset($this->overridable [$level->getBlockIdAt($xx, $y, $zz)]))
if (! isset($this->overridable[$level->getBlockIdAt($xx, $y, $zz)]))
$level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK);
// Entrance
for($i = 0; $i < 2; $i ++) {
@ -169,7 +169,7 @@ class Igloo extends Object {
// Ground
for($xx = $x - 4; $xx <= $x + 3; $xx ++)
for($zz = $z - 3; $zz <= $z + 3; $zz ++)
if (! isset($this->overridable [$level->getBlockIdAt($xx, $y, $zz)]))
if (! isset($this->overridable[$level->getBlockIdAt($xx, $y, $zz)]))
$level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK);
// Entrance
for($i = 0; $i < 2; $i ++) {
@ -243,7 +243,7 @@ class Igloo extends Object {
// Ground
for($xx = $x - 3; $xx <= $x + 3; $xx ++)
for($zz = $z - 3; $zz <= $z + 4; $zz ++)
if (! isset($this->overridable [$level->getBlockIdAt($xx, $y, $zz)]))
if (! isset($this->overridable[$level->getBlockIdAt($xx, $y, $zz)]))
$level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK);
// Entrance
for($i = 0; $i < 2; $i ++) {
@ -317,7 +317,7 @@ class Igloo extends Object {
// Ground
for($xx = $x - 3; $xx <= $x + 3; $xx ++)
for($zz = $z - 4; $zz <= $z + 3; $zz ++)
if (! isset($this->overridable [$level->getBlockIdAt($xx, $y, $zz)]))
if (! isset($this->overridable[$level->getBlockIdAt($xx, $y, $zz)]))
$level->setBlockIdAt($xx, $y, $zz, Block::SNOW_BLOCK);
// Entrance
for($i = 0; $i < 2; $i ++) {

Datei anzeigen

@ -493,7 +493,7 @@ class SakuraTree extends Tree {
$zDiff = 0;
break;
}
list($vParts, $hParts) = self::TRUNK_POS [$trunkHeight];
list($vParts, $hParts) = self::TRUNK_POS[$trunkHeight];
$this->setLog($level, $x, $y, $z);
list($lastX, $lastY, $lastZ) = [
@ -643,15 +643,15 @@ class SakuraTree extends Tree {
}
// Leaves falling from the tree diagonally
foreach (self::DIAG_LEAVES [$trunkHeight] as $pos) {
foreach (self::DIAG_LEAVES[$trunkHeight] as $pos) {
$numDown = $random->nextBoundedInt(3) + 1;
for ($y = $lastY + 1; $y > $lastY - $numDown; $y--)
$this->setLeave($level, $lastX + $pos [0], $y, $lastZ + $pos [1], $random);
$this->setLeave($level, $lastX + $pos[0], $y, $lastZ + $pos[1], $random);
}
// Additional leaves
foreach (self::ADDITIONAL_BLOCKS [$trunkHeight] as $pos) {
$this->setLeave($level, $lastX + $pos [0], $lastY + 2, $lastZ + $pos [1], $random);
foreach (self::ADDITIONAL_BLOCKS[$trunkHeight] as $pos) {
$this->setLeave($level, $lastX + $pos[0], $lastY + 2, $lastZ + $pos[1], $random);
}
}
}

Datei anzeigen

@ -127,7 +127,7 @@ class Temple extends Object {
for ($xx = $x - 10; $xx <= $x + 10; $xx++)
for ($yy = $y + 1; $yy <= $y + 11; $yy++)
for ($zz = $z - 10; $zz <= $z + 10; $zz++)
if (!isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz)]))
if (!isset($this->overridable[$level->getBlockIdAt($xx, $yy, $zz)]))
return false;
return true;
}
@ -203,8 +203,8 @@ class Temple extends Object {
}
foreach (self::THREE_DIAGS as $diagPos) {
$this->placeBlock($x + $diagPos [0], $y - 10, $z + $diagPos [1], Block::SANDSTONE, 1);
$this->placeBlock($x + $diagPos [0], $y - 11, $z + $diagPos [1], Block::SANDSTONE, 2);
$this->placeBlock($x + $diagPos[0], $y - 10, $z + $diagPos[1], Block::SANDSTONE, 1);
$this->placeBlock($x + $diagPos[0], $y - 11, $z + $diagPos[1], Block::SANDSTONE, 2);
}
// Floor + TNT

Datei anzeigen

@ -69,7 +69,7 @@ class Well extends Object {
for($xx = $x - 2; $xx <= $x + 2; $xx ++)
for($yy = $y; $yy <= $y + 3; $yy ++)
for($zz = $z - 2; $zz <= $z + 2; $zz ++)
if (! isset($this->overridable [$level->getBlockIdAt($xx, $yy, $zz)]))
if (! isset($this->overridable[$level->getBlockIdAt($xx, $yy, $zz)]))
return false;
return true;
}