Browse Source

Final touches

pull/18/head
thebigsmileXD 2 years ago
parent
commit
4ccd95196f

+ 1
- 0
processingLoots.json View File

@@ -0,0 +1 @@
[]

+ 1
- 1
src/Ad5001/BetterGen/generator/BetterNormal.php View File

@@ -447,6 +447,6 @@ class BetterNormal extends Generator {
}
}
return $y++;
return ++$y;
}
}

+ 1
- 1
src/Ad5001/BetterGen/populator/BushPopulator.php View File

@@ -71,6 +71,6 @@ class BushPopulator extends AmountPopulator {
}
}
return $y++;
return ++$y;
}
}

+ 1
- 1
src/Ad5001/BetterGen/populator/CactusPopulator.php View File

@@ -65,6 +65,6 @@ class CactusPopulator extends AmountPopulator {
break;
}
}
return $y === 0 ? - 1 : $y++;
return $y === 0 ? - 1 : ++$y;
}
}

+ 1
- 1
src/Ad5001/BetterGen/populator/CavePopulator.php View File

@@ -75,7 +75,7 @@ class CavePopulator extends AmountPopulator {
}
}
return $y++;
return ++$y;
}
/*

+ 1
- 1
src/Ad5001/BetterGen/populator/DeadbushPopulator.php View File

@@ -56,6 +56,6 @@ class DeadbushPopulator extends AmountPopulator {
break;
}
}
return $y === 0 ? - 1 : $y++;
return $y === 0 ? - 1 : ++$y;
}
}

+ 15
- 12
src/Ad5001/BetterGen/populator/FallenTreePopulator.php View File

@@ -1,10 +1,10 @@
<?php
/**
* ____ __ __ ____
* /\ _`\ /\ \__ /\ \__ /\ _`\
* \ \ \L\ \ __ \ \ ,_\\ \ ,_\ __ _ __ \ \ \L\_\ __ ___
* \ \ _ <' /'__`\\ \ \/ \ \ \/ /'__`\/\`'__\\ \ \L_L /'__`\ /' _ `\
* \ \ \L\ \/\ __/ \ \ \_ \ \ \_ /\ __/\ \ \/ \ \ \/, \/\ __/ /\ \/\ \
* ____ __ __ ____
* /\ _`\ /\ \__ /\ \__ /\ _`\
* \ \ \L\ \ __ \ \ ,_\\ \ ,_\ __ _ __ \ \ \L\_\ __ ___
* \ \ _ <' /'__`\\ \ \/ \ \ \/ /'__`\/\`'__\\ \ \L_L /'__`\ /' _ `\
* \ \ \L\ \/\ __/ \ \ \_ \ \ \_ /\ __/\ \ \/ \ \ \/, \/\ __/ /\ \/\ \
* \ \____/\ \____\ \ \__\ \ \__\\ \____\\ \_\ \ \____/\ \____\\ \_\ \_\
* \/___/ \/____/ \/__/ \/__/ \/____/ \/_/ \/___/ \/____/ \/_/\/_/
* Tomorrow's pocketmine generator.
@@ -34,7 +34,7 @@ class FallenTreePopulator extends AmountPopulator {
$this->setBaseAmount(1);
$this->setRandomAmount(2);
}
/*
* Populate the chunk
* @param $level pocketmine\level\ChunkManager
@@ -46,7 +46,9 @@ class FallenTreePopulator extends AmountPopulator {
$this->level = $level;
$amount = $this->getAmount($random);
$tree = TreePopulator::$types[$this->type];
$fallenTree = new FallenTree(new $tree());
$fallenTree = new \Ad5001\BetterGen\structure\FallenTree(
new $tree()
);
for($i = 0; $i < $amount; $i++) {
$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);
$z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);
@@ -56,11 +58,12 @@ class FallenTreePopulator extends AmountPopulator {
}
}
}
/*
/**
* Gets the top block (y) on an x and z axes
* @param $x int
* @param $z int
* @param $x
* @param $z
* @return int
*/
protected function getHighestWorkableBlock($x, $z) {
for($y = Level::Y_MAX; $y >= 0; -- $y) {
@@ -69,6 +72,6 @@ class FallenTreePopulator extends AmountPopulator {
break;
}
}
return $y === 0 ? - 1 : $y++;
return $y === 0 ? - 1 : ++$y;
}
}

+ 4
- 4
src/Ad5001/BetterGen/populator/FloatingIslandPopulator.php View File

@@ -78,7 +78,7 @@ class FloatingIslandPopulator extends AmountPopulator {
}
}
return $y++;
return ++$y;
}
@@ -89,7 +89,7 @@ class FloatingIslandPopulator extends AmountPopulator {
* @param $pos pocketmine\math\Vector3
* @param $radius int
* @param $random pocketmine\utils\Random
* @return void
* @return int lowest ore point
*/
public function buildIslandBottomShape(ChunkManager $level, Vector3 $pos, int $radius, Random $random) {
$pos = $pos->round();
@@ -122,13 +122,13 @@ class FloatingIslandPopulator extends AmountPopulator {
$oldHB = $hBound;
$hBound = $random->nextFloat();
if($current >= $currentLen + $hBound) {
if($radius == 0) return;
if($radius == 0) return $pos->y;
$current = 0;
$currentLen += 0.3 * ($random->nextFloat() + 0.5);
$radius--;
}
}
//return $pos->y - 1 - $y;//void
return $pos->y - 1 - $y;
}

+ 1
- 1
src/Ad5001/BetterGen/populator/IglooPopulator.php View File

@@ -58,6 +58,6 @@ class IglooPopulator extends AmountPopulator {
}
}
return $y++;
return ++$y;
}
}

+ 1
- 1
src/Ad5001/BetterGen/populator/LakePopulator.php View File

@@ -67,6 +67,6 @@ class LakePopulator extends AmountPopulator {
}
}
return $y++;
return ++$y;
}
}

+ 1
- 1
src/Ad5001/BetterGen/populator/RavinePopulator.php View File

@@ -84,7 +84,7 @@ class RavinePopulator extends AmountPopulator {
}
}
return $y++;
return ++$y;
}
/*

+ 1
- 1
src/Ad5001/BetterGen/populator/SugarCanePopulator.php View File

@@ -64,6 +64,6 @@ class SugarCanePopulator extends AmountPopulator {
break;
}
}
return $y === 0 ? - 1 : $y++;
return $y === 0 ? - 1 : ++$y;
}
}

+ 1
- 1
src/Ad5001/BetterGen/populator/TemplePopulator.php View File

@@ -56,6 +56,6 @@ class TemplePopulator extends AmountPopulator {
}
}
return $y++;
return ++$y;
}
}

+ 1
- 1
src/Ad5001/BetterGen/populator/TreePopulator.php View File

@@ -86,6 +86,6 @@ class TreePopulator extends AmountPopulator {
}
}
return $y++;
return ++$y;
}
}

+ 1
- 1
src/Ad5001/BetterGen/populator/WellPopulator.php View File

@@ -56,6 +56,6 @@ class WellPopulator extends AmountPopulator {
}
}
return $y++;
return ++$y;
}
}

+ 11
- 10
src/Ad5001/BetterGen/structure/FallenTree.php View File

@@ -18,7 +18,7 @@ use Ad5001\BetterGen\utils\BuildingUtils;
use pocketmine\block\Block;
use pocketmine\level\ChunkManager;
use pocketmine\level\generator\object\Object;
use pocketmine\level\generator\object\Tree;
use pocketmine\level\generator\object\Tree as ObjectTree;
use pocketmine\math\Vector3;
use pocketmine\utils\Random;

@@ -36,18 +36,17 @@ class FallenTree extends Object {
Block::LEAVES2 => true,
Block::CACTUS => true
];
/** @var Tree */
protected $tree;
protected $direction;
protected $random;
private $length;
private $length = 0;

/*
* Constructs the class
* @param $tree Tree
* @throws Exception
* @param $tree ObjectTree
* @throws Exeption
*/
public function __construct(Tree $tree) {
public function __construct(ObjectTree $tree) {
$this->tree = $tree;
}

@@ -61,14 +60,15 @@ class FallenTree extends Object {
*/
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
$randomHeight = round($random->nextBoundedInt(6) - 3);
$this->length = $this->tree->trunkHeight + $randomHeight;
$this->length = ($this->tree->trunkHeight??5) + $randomHeight;
$this->direction = $random->nextBoundedInt(4);
$this->random = $random;
switch ($this->direction) {
case 0:
case 1:// Z+
if (in_array(false, BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x, $y, $z + $this->length), function ($v3, ChunkManager $level) {
if (!in_array($level->getBlockIdAt($v3->x, $v3->y, $v3->z), $this->overridable)) return false; else return true;
if (!in_array($level->getBlockIdAt($v3->x, $v3->y, $v3->z), $this->overridable)) return false;
else return true;
}, $level))) {
return false;
}
@@ -76,7 +76,8 @@ class FallenTree extends Object {
case 2:
case 3: // X+
if (in_array(false, BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x + $this->length, $y, $z), function ($v3, ChunkManager $level) {
if (!in_array($level->getBlockIdAt($v3->x, $v3->y, $v3->z), $this->overridable)) return false; else return true;
if (!in_array($level->getBlockIdAt($v3->x, $v3->y, $v3->z), $this->overridable)) return false;
else return true;
}, $level))) {
return false;
}
@@ -136,7 +137,7 @@ class FallenTree extends Object {
*/
public function placeBlock($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->tree->trunkBlock);
$level->setBlockIdAt($x, $y, $z, $this->tree->leafBlock);
$level->setBlockDataAt($x, $y, $z, $this->tree->type);
}
}

+ 1
- 1
src/Ad5001/BetterGen/structure/SakuraTree.php View File

@@ -569,7 +569,7 @@ class SakuraTree extends Tree {
$sideLen = $totalLength ** 2; // Side length

//TODO CHECK WHAT THIS IS SUPPOSED TO BE
$numForward = 0;
$numForward = $sideLen;
//TODO END
$lX1 = $lZ1 = $lX = $lZ = 0;


Loading…
Cancel
Save