forked from Ad5001/BetterGen
Merge pull request #34 from wyt3dr4g0n/master
Updated code for 3.0.0ALPHA9
This commit is contained in:
commit
e7ef5620d1
17 changed files with 76 additions and 82 deletions
|
@ -17,7 +17,7 @@ author: Ad5001
|
|||
main: Ad5001\BetterGen\Main
|
||||
version: 1.1
|
||||
load: STARTUP
|
||||
api: [3.0.1, 3.0.0-ALPHA3]
|
||||
api: [3.0.0-ALPHA9]
|
||||
commands:
|
||||
createworld:
|
||||
description: Generates a new world.
|
||||
|
@ -38,4 +38,4 @@ permissions:
|
|||
default: op
|
||||
bettergen.cmd.debug:
|
||||
default: op
|
||||
...
|
||||
...
|
||||
|
|
|
@ -127,15 +127,13 @@ class Main extends PluginBase implements Listener {
|
|||
return true;
|
||||
}
|
||||
$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);
|
||||
}
|
||||
$seed = implode("", $parts);
|
||||
} else {
|
||||
$seed = $args[2];
|
||||
}
|
||||
$parts = str_split($args[2]);
|
||||
foreach ($parts as $key=>$str) {
|
||||
if(is_numeric($str) == false && $str <> '-'){
|
||||
$parts[$key] = ord($str);
|
||||
}
|
||||
}
|
||||
$seed = (int)implode("", $parts);
|
||||
$options = [];
|
||||
break;
|
||||
default : // /createworld <name> [generator = betternormal] [seed = rand()] [options(json)]
|
||||
|
@ -147,15 +145,13 @@ class Main extends PluginBase implements Listener {
|
|||
}
|
||||
$generatorName = strtolower($args[1]);
|
||||
if ($args[2] == "rand") $args[2] = $this->generateRandomSeed();
|
||||
if (preg_match("[^\d]", $args[2]) !== false) {
|
||||
$parts = str_split($args[2]);
|
||||
foreach ($parts as $key => $str) {
|
||||
$parts[$key] = ord($str);
|
||||
}
|
||||
$seed = implode("", $parts);
|
||||
} else {
|
||||
$seed = $args[2];
|
||||
}
|
||||
$parts = str_split($args[2]);
|
||||
foreach ($parts as $key=>$str) {
|
||||
if(is_numeric($str) == false && $str <> '-'){
|
||||
$parts[$key] = ord($str);
|
||||
}
|
||||
}
|
||||
$seed = (int)implode("", $parts);
|
||||
unset($args[0], $args[1], $args[2]);
|
||||
$options = json_decode($args[3], true);
|
||||
if (!is_array($options)) {
|
||||
|
|
|
@ -76,7 +76,7 @@ class BetterForest extends ForestBiome implements Mountainable {
|
|||
$this->temperature = $infos[0];
|
||||
$this->rainfall = $infos[1];
|
||||
}
|
||||
public function getName() {
|
||||
public function getName(): string {
|
||||
return str_ireplace(" ", "", self::$types[$this->type]);
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ class BetterForest extends ForestBiome implements Mountainable {
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId() {
|
||||
public function getId(): int {
|
||||
return self::$ids[$this->type];
|
||||
}
|
||||
/**
|
||||
|
@ -103,4 +103,4 @@ class BetterForest extends ForestBiome implements Mountainable {
|
|||
Main::register(Main::SAKURA_FOREST + (count(self::$types) - 2), new BetterForest(count(self::$types) - 1, $infos));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ class BetterMesa extends SandyBiome {
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId() {
|
||||
public function getId(): int {
|
||||
return 39;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ class BetterMesaPlains extends SandyBiome {
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId() {
|
||||
public function getId(): int {
|
||||
return 40;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class BetterBiomeSelector extends BiomeSelector {
|
|||
*
|
||||
* @return Biome
|
||||
*/
|
||||
public function pickBiome($x, $z) {
|
||||
public function pickBiome($x, $z): Biome {
|
||||
$temperature = ($this->getTemperature($x, $z));
|
||||
$rainfall = ($this->getRainfall($x, $z));
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class BetterNormal extends Generator {
|
|||
* @param $z int
|
||||
* @return Biome
|
||||
*/
|
||||
public function pickBiome($x, $z) {
|
||||
public function pickBiome($x, $z): Biome {
|
||||
$hash = $x * 2345803 ^ $z * 9236449 ^ $this->level->getSeed ();
|
||||
$hash *= $hash + 223;
|
||||
$xNoise = $hash >> 20 & 3;
|
||||
|
|
|
@ -100,7 +100,7 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
// Then, making sure the floor is solid.
|
||||
BuildingUtils::fillCallback(new Vector3($x, $y - 1, $z - 1), new Vector3($x + 4, $y - 1, $z + 1), function ($v3, ChunkManager $level) {
|
||||
if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANKS);
|
||||
}, $this->level);
|
||||
// Putting rails
|
||||
BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x + 4, $y, $z), function ($v3, ChunkManager $level, Random $random) {
|
||||
|
@ -114,9 +114,9 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
$level->setBlockIdAt($x, $y, $z + 1, Block::FENCE);
|
||||
$level->setBlockIdAt($x, $y + 1, $z - 1, Block::FENCE);
|
||||
$level->setBlockIdAt($x, $y + 1, $z + 1, Block::FENCE);
|
||||
$level->setBlockIdAt($x, $y + 2, $z - 1, Block::PLANK);
|
||||
$level->setBlockIdAt($x, $y + 2, $z, Block::PLANK);
|
||||
$level->setBlockIdAt($x, $y + 2, $z + 1, Block::PLANK);
|
||||
$level->setBlockIdAt($x, $y + 2, $z - 1, Block::PLANKS);
|
||||
$level->setBlockIdAt($x, $y + 2, $z, Block::PLANKS);
|
||||
$level->setBlockIdAt($x, $y + 2, $z + 1, Block::PLANKS);
|
||||
$level->setBlockIdAt($x + 1, $y + 2, $z, Block::TORCH);
|
||||
$level->setBlockDataAt($x + 1, $y + 2, $z, 2);
|
||||
// Generating chest
|
||||
|
@ -141,7 +141,7 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
BuildingUtils::fillCallback(new Vector3($x, $y - 1, $z - 1), new Vector3($x - 4, $y - 1, $z + 1), function ($v3, ChunkManager $level) {
|
||||
|
||||
if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANKS);
|
||||
}, $this->level);
|
||||
// Putting rails
|
||||
BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x - 4, $y, $z), function ($v3, ChunkManager $level, Random $random) {
|
||||
|
@ -155,9 +155,9 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
$level->setBlockIdAt($x, $y, $z + 1, Block::FENCE);
|
||||
$level->setBlockIdAt($x, $y + 1, $z - 1, Block::FENCE);
|
||||
$level->setBlockIdAt($x, $y + 1, $z + 1, Block::FENCE);
|
||||
$level->setBlockIdAt($x, $y + 2, $z - 1, Block::PLANK);
|
||||
$level->setBlockIdAt($x, $y + 2, $z, Block::PLANK);
|
||||
$level->setBlockIdAt($x, $y + 2, $z + 1, Block::PLANK);
|
||||
$level->setBlockIdAt($x, $y + 2, $z - 1, Block::PLANKS);
|
||||
$level->setBlockIdAt($x, $y + 2, $z, Block::PLANKS);
|
||||
$level->setBlockIdAt($x, $y + 2, $z + 1, Block::PLANKS);
|
||||
$level->setBlockIdAt($x - 1, $y + 2, $z, Block::TORCH);
|
||||
$level->setBlockDataAt($x - 1, $y + 2, $z, 1);
|
||||
// Generating chest
|
||||
|
@ -182,7 +182,7 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
BuildingUtils::fillCallback(new Vector3($x - 1, $y - 1, $z), new Vector3($x + 1, $y - 1, $z + 4), function ($v3, ChunkManager $level) {
|
||||
|
||||
if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANKS);
|
||||
}, $this->level);
|
||||
// Putting rails
|
||||
BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x, $y, $z + 4), function ($v3, ChunkManager $level, Random $random) {
|
||||
|
@ -196,9 +196,9 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
$level->setBlockIdAt($x + 1, $y, $z, Block::FENCE);
|
||||
$level->setBlockIdAt($x - 1, $y + 1, $z, Block::FENCE);
|
||||
$level->setBlockIdAt($x + 1, $y + 1, $z, Block::FENCE);
|
||||
$level->setBlockIdAt($x - 1, $y + 2, $z, Block::PLANK);
|
||||
$level->setBlockIdAt($x, $y + 2, $z, Block::PLANK);
|
||||
$level->setBlockIdAt($x + 1, $y + 2, $z, Block::PLANK);
|
||||
$level->setBlockIdAt($x - 1, $y + 2, $z, Block::PLANKS);
|
||||
$level->setBlockIdAt($x, $y + 2, $z, Block::PLANKS);
|
||||
$level->setBlockIdAt($x + 1, $y + 2, $z, Block::PLANKS);
|
||||
$level->setBlockIdAt($x, $y + 2, $z - 1, Block::TORCH);
|
||||
$level->setBlockDataAt($x, $y + 2, $z - 1, 4);
|
||||
// Generating chest
|
||||
|
@ -223,7 +223,7 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
BuildingUtils::fillCallback(new Vector3($x - 1, $y - 1, $z), new Vector3($x + 1, $y - 1, $z - 4), function ($v3, ChunkManager $level) {
|
||||
|
||||
if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANKS);
|
||||
}, $this->level);
|
||||
// Putting rails
|
||||
BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x, $y, $z - 4), function ($v3, ChunkManager $level, Random $random) {
|
||||
|
@ -237,9 +237,9 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
$level->setBlockIdAt($x + 1, $y, $z, Block::FENCE);
|
||||
$level->setBlockIdAt($x - 1, $y + 1, $z, Block::FENCE);
|
||||
$level->setBlockIdAt($x + 1, $y + 1, $z, Block::FENCE);
|
||||
$level->setBlockIdAt($x - 1, $y + 2, $z, Block::PLANK);
|
||||
$level->setBlockIdAt($x, $y + 2, $z, Block::PLANK);
|
||||
$level->setBlockIdAt($x + 1, $y + 2, $z, Block::PLANK);
|
||||
$level->setBlockIdAt($x - 1, $y + 2, $z, Block::PLANKS);
|
||||
$level->setBlockIdAt($x, $y + 2, $z, Block::PLANKS);
|
||||
$level->setBlockIdAt($x + 1, $y + 2, $z, Block::PLANKS);
|
||||
$level->setBlockIdAt($x, $y + 2, $z - 1, Block::TORCH);
|
||||
$level->setBlockDataAt($x, $y + 2, $z - 1, 3);
|
||||
// Generating chest
|
||||
|
@ -298,13 +298,13 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
BuildingUtils::fillCallback(new Vector3($x + 1, $y - 1, $z - 1), new Vector3($x - 1, $y - 1, $z + 1), function ($v3, ChunkManager $level) {
|
||||
|
||||
if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANKS);
|
||||
}, $this->level);
|
||||
// Putting rails
|
||||
|
||||
BuildingUtils::fill($this->level, new Vector3($x - 1, $y, $z - 1), new Vector3($x + 1, $y + 6, $z + 1), Block::get(Block::AIR));
|
||||
|
||||
BuildingUtils::corners($this->level, new Vector3($x - 1, $y, $z - 1), new Vector3($x + 1, $y + 6, $z + 1), Block::get(Block::PLANK));
|
||||
BuildingUtils::corners($this->level, new Vector3($x - 1, $y, $z - 1), new Vector3($x + 1, $y + 6, $z + 1), Block::get(Block::PLANKS));
|
||||
|
||||
$newFloor = $random->nextBoolean ();
|
||||
$numberFloor = $random->nextBoundedInt(4 + ($newFloor ? 5 : 0));
|
||||
|
@ -378,7 +378,7 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
BuildingUtils::fill($this->level, new Vector3($x + $i, $y - $i - 1, $z - 2), new Vector3($x + $i, $y - $i + 3, $z + 2), Block::get(Block::AIR));
|
||||
BuildingUtils::fillCallback(new Vector3($x + $i, $y - $i - 2, $z - 2), new Vector3($x + $i, $y - $i - 2, $z + 2), function ($v3, ChunkManager $level) {
|
||||
if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANKS);
|
||||
}, $this->level);
|
||||
break;
|
||||
case self::DIR_XMIN :
|
||||
|
@ -386,7 +386,7 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
BuildingUtils::fillCallback(new Vector3($x - $i, $y - $i - 2, $z - 2), new Vector3($x - $i, $y - $i - 2, $z + 2), function ($v3, ChunkManager $level) {
|
||||
|
||||
if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANKS);
|
||||
}, $this->level);
|
||||
break;
|
||||
case self::DIR_ZPLUS :
|
||||
|
@ -394,7 +394,7 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
BuildingUtils::fillCallback(new Vector3($x - 2, $y - $i - 2, $z + $i), new Vector3($x + 2, $y - $i - 2, $z + $i), function ($v3, ChunkManager $level) {
|
||||
|
||||
if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANKS);
|
||||
}, $this->level);
|
||||
break;
|
||||
case self::DIR_ZMIN :
|
||||
|
@ -402,7 +402,7 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
BuildingUtils::fillCallback(new Vector3($x - 2, $y - $i - 2, $z - $i), new Vector3($x + 2, $y - $i - 2, $z - $i), function ($v3, ChunkManager $level) {
|
||||
|
||||
if ($level->getBlockIdAt($v3->x, $v3->y, $v3->z) == Block::AIR)
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANK);
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::PLANKS);
|
||||
}, $this->level);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -19,11 +19,11 @@ namespace Ad5001\BetterGen\structure;
|
|||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\level\generator\object\PopulatorObject;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class Bush extends Object {
|
||||
class Bush extends PopulatorObject {
|
||||
public $overridable = [
|
||||
Block::AIR => true,
|
||||
17 => true,
|
||||
|
|
|
@ -19,10 +19,10 @@ namespace Ad5001\BetterGen\structure;
|
|||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\level\generator\object\PopulatorObject;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class Cactus extends Object {
|
||||
class Cactus extends PopulatorObject {
|
||||
|
||||
protected $totalHeight;
|
||||
|
||||
|
@ -64,4 +64,4 @@ class Cactus extends Object {
|
|||
$level->setBlockIdAt($x, $y + $yy, $z, Block::CACTUS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ namespace Ad5001\BetterGen\structure;
|
|||
use Ad5001\BetterGen\utils\BuildingUtils;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\level\generator\object\PopulatorObject;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class Dungeons extends Object {
|
||||
class Dungeons extends PopulatorObject {
|
||||
public $overridable = [
|
||||
Block::AIR => true,
|
||||
17 => true,
|
||||
|
|
|
@ -20,13 +20,13 @@ namespace Ad5001\BetterGen\structure;
|
|||
use Ad5001\BetterGen\utils\BuildingUtils;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\level\generator\object\PopulatorObject;
|
||||
use pocketmine\level\generator\object\Tree as ObjectTree;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
|
||||
class FallenTree extends Object {
|
||||
class FallenTree extends PopulatorObject {
|
||||
public static $overridable = [
|
||||
Block::AIR => true,
|
||||
6 => true,
|
||||
|
@ -37,8 +37,7 @@ class FallenTree extends Object {
|
|||
Block::SNOW_LAYER => true,
|
||||
Block::LOG2 => true,
|
||||
Block::LEAVES2 => true,
|
||||
Block::CACTUS => true
|
||||
];
|
||||
Block::CACTUS => true];
|
||||
/** @var Tree */
|
||||
protected $tree;
|
||||
/** @var int */
|
||||
|
@ -68,9 +67,9 @@ class FallenTree extends Object {
|
|||
* @return void
|
||||
*/
|
||||
public function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random) {
|
||||
echo "Checking at $x $y $z FallenTree\n";
|
||||
$randomHeight = round($random->nextBoundedInt($this->tree->trunkHeight < 6 ? 6 : $this->tree->trunkHeight) - ($this->tree->trunkHeight < 6 ? 3 : $this->tree->trunkHeight / 2));
|
||||
$this->length = ($this->tree->trunkHeight ?? 5) + $randomHeight;
|
||||
//echo "Checking at $x $y $z FallenTree\n";
|
||||
$randomHeight = round($random->nextBoundedInt($this->tree->treeHeight < 6 ? 6 : $this->tree->treeHeight) - ($this->tree->treeHeight < 6 ? 3 : $this->tree->treeHeight / 2));
|
||||
$this->length = ($this->tree->treeHeight ?? 5) + $randomHeight;
|
||||
$this->direction = $random->nextBoundedInt(4);
|
||||
$this->random = $random;
|
||||
switch ($this->direction) {
|
||||
|
@ -78,12 +77,12 @@ class FallenTree extends Object {
|
|||
case 1:// Z+
|
||||
$return = array_merge(BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x, $y, $z + $this->length), function($v3, $level) {
|
||||
if(!isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
|
||||
echo "$v3 is not overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
|
||||
//echo "$v3 is not overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
|
||||
return false;
|
||||
}
|
||||
}, $level), BuildingUtils::fillCallback(new Vector3($x, $y - 1, $z), new Vector3($x, $y - 1, $z + $this->length), function($v3, $level) {
|
||||
if(isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
|
||||
echo "$v3 is overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
|
||||
//echo "$v3 is overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
|
||||
return false;
|
||||
}
|
||||
}, $level));
|
||||
|
@ -95,12 +94,12 @@ class FallenTree extends Object {
|
|||
case 3: // X+
|
||||
$return = array_merge(BuildingUtils::fillCallback(new Vector3($x, $y, $z), new Vector3($x + $this->length, $y, $z), function($v3, $level) {
|
||||
if(!isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
|
||||
echo "$v3 is not overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
|
||||
//echo "$v3 is not overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
|
||||
return false;
|
||||
}
|
||||
}, $level), BuildingUtils::fillCallback(new Vector3($x, $y - 1, $z), new Vector3($x + $this->length, $y - 1, $z), function($v3, $level) {
|
||||
if(isset(\Ad5001\BetterGen\structure\FallenTree::$overridable[$level->getBlockIdAt($v3->x, $v3->y, $v3->z)])) {
|
||||
echo "$v3 is overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
|
||||
//echo "$v3 is overwritable (" . $level->getBlockIdAt($v3->x, $v3->y, $v3->z) . ").\n";
|
||||
return false;
|
||||
}
|
||||
}, $level));
|
||||
|
@ -122,7 +121,7 @@ class FallenTree extends Object {
|
|||
* @return void
|
||||
*/
|
||||
public function placeObject(ChunkManager $level, $x, $y, $z) {
|
||||
echo "Placing at $x $y $z FallenTree D: $this->direction, L: $this->length\n";
|
||||
//echo "Placing at $x $y $z FallenTree D: $this->direction, L: $this->length\n";
|
||||
switch ($this->direction) {
|
||||
case 0:
|
||||
$level->setBlockIdAt($x, $y, $z, $this->tree->trunkBlock);
|
||||
|
@ -173,4 +172,4 @@ class FallenTree extends Object {
|
|||
$level->setBlockDataAt($x, $y, $z, $this->trunk[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,10 +19,10 @@ namespace Ad5001\BetterGen\structure;
|
|||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\level\generator\object\PopulatorObject;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class Igloo extends Object {
|
||||
class Igloo extends PopulatorObject {
|
||||
public $overridable = [
|
||||
Block::AIR => true,
|
||||
6 => true,
|
||||
|
|
|
@ -20,10 +20,10 @@ namespace Ad5001\BetterGen\structure;
|
|||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\level\generator\object\PopulatorObject;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class SugarCane extends Object {
|
||||
class SugarCane extends PopulatorObject {
|
||||
|
||||
protected $totalHeight;
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@ namespace Ad5001\BetterGen\structure;
|
|||
use Ad5001\BetterGen\utils\BuildingUtils;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\level\generator\object\PopulatorObject;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class Temple extends Object {
|
||||
class Temple extends PopulatorObject {
|
||||
const DIRECTION_PLUSX = 0;
|
||||
const DIRECTION_MINX = 1;
|
||||
const DIRECTION_PLUSZ = 2;
|
||||
|
|
|
@ -20,11 +20,11 @@ namespace Ad5001\BetterGen\structure;
|
|||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\level\generator\object\PopulatorObject;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
|
||||
class Well extends Object {
|
||||
class Well extends PopulatorObject {
|
||||
/** @var ChunkManager */
|
||||
protected $level;
|
||||
public $overridable = [
|
||||
|
|
|
@ -30,8 +30,7 @@ class BuildingUtils {
|
|||
Block::LAVA,
|
||||
Block::BEDROCK,
|
||||
Block::CACTUS,
|
||||
Block::PLANK
|
||||
];
|
||||
Block::PLANKS];
|
||||
|
||||
/**
|
||||
* Fills an area
|
||||
|
@ -219,4 +218,4 @@ class BuildingUtils {
|
|||
$v2
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue