Undefined fixes
This commit is contained in:
parent
796c10f51a
commit
055014aa88
33 changed files with 620 additions and 632 deletions
|
@ -14,29 +14,26 @@
|
|||
|
||||
namespace Ad5001\BetterGen;
|
||||
|
||||
use Ad5001\BetterGen\biome\BetterForest;
|
||||
use Ad5001\BetterGen\generator\BetterNormal;
|
||||
use Ad5001\BetterGen\loot\LootTable;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\event\block\BlockBreakEvent;
|
||||
use pocketmine\event\level\ChunkPopulateEvent;
|
||||
use pocketmine\event\Listener;
|
||||
use pocketmine\plugin\PluginBase;
|
||||
use pocketmine\event\player\PlayerInteractEvent;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\level\generator\Generator;
|
||||
use pocketmine\level\generator\normal\Normal;
|
||||
use pocketmine\event\level\ChunkPopulateEvent;
|
||||
use Ad5001\BetterGen\generator\BetterNormal;
|
||||
use Ad5001\BetterGen\biome\BetterForest;
|
||||
use Ad5001\BetterGen\loot\LootTable;
|
||||
use pocketmine\utils\Config;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\tile\Chest;
|
||||
use pocketmine\nbt\NBT;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\plugin\PluginBase;
|
||||
use pocketmine\tile\Chest;
|
||||
use pocketmine\tile\Tile;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\event\player\PlayerInteractEvent;
|
||||
use pocketmine\event\block\BlockBreakEvent;
|
||||
use pocketmine\utils\Config;
|
||||
|
||||
class Main extends PluginBase implements Listener {
|
||||
const PREFIX = "§l§o§b[§r§l§2Better§aGen§o§b]§r§f ";
|
||||
|
@ -214,7 +211,6 @@ class Main extends PluginBase implements Listener {
|
|||
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
|
||||
if($event->getBlock()->getId() !== Block::CHEST) return;
|
||||
if(!$cfg->exists($event->getBlock()->getX() . ";" . $event->getBlock()->getY() . ";" . $event->getBlock()->getZ())) return;
|
||||
$chest = new \pocketmine\block\Chest(0);
|
||||
$nbt = new CompoundTag("", [
|
||||
new ListTag("Items", []),
|
||||
new StringTag("id", Tile::CHEST),
|
||||
|
@ -222,12 +218,10 @@ class Main extends PluginBase implements Listener {
|
|||
new IntTag("y", $event->getBlock()->y),
|
||||
new IntTag("z", $event->getBlock()->z)
|
||||
]);
|
||||
$chest->setLevel($event->getBlock()->getLevel());
|
||||
$cItem = Item::get(Item::CHEST, 0);
|
||||
$cItem->setCustomName("§k(Fake)§r Minecart chest");
|
||||
$chest->place($cItem, $event->getBlock()->getLevel()->getBlock($event->getBlock()), $chest, 0, 0, 0, 0);
|
||||
$inv = $event->getBlock()->getLevel()->getTile($event->getBlock());
|
||||
LootTable::fillChest($inv->getInventory(), $event->getBlock());
|
||||
/** @var Chest $chest */
|
||||
$chest = Tile::createTile(Tile::CHEST, $event->getBlock()->getLevel(), $nbt);
|
||||
$chest->setName("§k(Fake)§r Minecart chest");
|
||||
LootTable::fillChest($chest->getInventory(), $event->getBlock());
|
||||
}
|
||||
|
||||
|
||||
|
@ -238,7 +232,6 @@ class Main extends PluginBase implements Listener {
|
|||
$cfg = new Config(LootTable::getPluginFolder() . "processingLoots.json", Config::JSON);
|
||||
if($event->getBlock()->getId() !== Block::CHEST) return;
|
||||
if(!$cfg->exists($event->getBlock()->getX() . ";" . $event->getBlock()->getY() . ";" . $event->getBlock()->getZ())) return;
|
||||
$chest = new \pocketmine\block\Chest(0);
|
||||
$nbt = new CompoundTag("", [
|
||||
new ListTag("Items", []),
|
||||
new StringTag("id", Tile::CHEST),
|
||||
|
@ -246,13 +239,11 @@ class Main extends PluginBase implements Listener {
|
|||
new IntTag("y", $event->getBlock()->y),
|
||||
new IntTag("z", $event->getBlock()->z)
|
||||
]);
|
||||
$chest->setLevel($event->getBlock()->getLevel());
|
||||
$cItem = Item::get(Item::CHEST, 0);
|
||||
$cItem->setCustomName("§k(Fake)§r Minecart chest");
|
||||
$chest->place($cItem, $event->getBlock()->getLevel()->getBlock($event->getBlock()), $chest, 0, 0, 0, 0);
|
||||
$inv = $event->getBlock()->getLevel()->getTile($event->getBlock());
|
||||
LootTable::fillChest($inv->getInventory(), $event->getBlock());
|
||||
$event->setCancelled();
|
||||
/** @var Chest $chest */
|
||||
$chest = Tile::createTile(Tile::CHEST, $event->getBlock()->getLevel(), $nbt);
|
||||
$chest->setName("§k(Fake)§r Minecart chest");
|
||||
LootTable::fillChest($chest->getInventory(), $event->getBlock());
|
||||
// $event->setCancelled(); //i think nope. You want to break it with items
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
*/
|
||||
namespace Ad5001\BetterGen\biome;
|
||||
|
||||
use pocketmine\level\generator\normal\biome\SandyBiome;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\block\Block;
|
||||
use Ad5001\BetterGen\populator\TemplePopulator;
|
||||
use Ad5001\BetterGen\populator\WellPopulator;
|
||||
use Ad5001\BetterGen\populator\CactusPopulator;
|
||||
use Ad5001\BetterGen\populator\DeadbushPopulator;
|
||||
use Ad5001\BetterGen\populator\SugarCanePopulator;
|
||||
use Ad5001\BetterGen\populator\TemplePopulator;
|
||||
use Ad5001\BetterGen\populator\WellPopulator;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\level\generator\normal\biome\SandyBiome;
|
||||
|
||||
class BetterDesert extends SandyBiome implements Mountainable {
|
||||
public function __construct() {
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
|
||||
namespace Ad5001\BetterGen\biome;
|
||||
|
||||
use pocketmine\level\generator\normal\biome\ForestBiome;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use Ad5001\BetterGen\Main;
|
||||
use Ad5001\BetterGen\populator\TreePopulator;
|
||||
use Ad5001\BetterGen\populator\BushPopulator;
|
||||
use Ad5001\BetterGen\populator\FallenTreePopulator;
|
||||
use Ad5001\BetterGen\populator\TreePopulator;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\level\generator\normal\biome\ForestBiome;
|
||||
|
||||
|
||||
class BetterForest extends ForestBiome implements Mountainable {
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
|
||||
namespace Ad5001\BetterGen\biome;
|
||||
|
||||
use pocketmine\level\generator\normal\biome\SnowyBiome;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\block\Block;
|
||||
use Ad5001\BetterGen\populator\IglooPopulator;
|
||||
use Ad5001\BetterGen\Main;
|
||||
use Ad5001\BetterGen\populator\IglooPopulator;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\level\generator\normal\biome\SnowyBiome;
|
||||
|
||||
class BetterIcePlains extends SnowyBiome implements Mountainable {
|
||||
public function __construct() {
|
||||
|
|
|
@ -14,17 +14,14 @@
|
|||
|
||||
namespace Ad5001\BetterGen\biome;
|
||||
|
||||
use pocketmine\level\generator\normal\biome\SandyBiome;
|
||||
use pocketmine\level\generator\populator\Ore;
|
||||
use pocketmine\level\generator\object\OreType;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\GoldOre;
|
||||
use Ad5001\BetterGen\Main;
|
||||
use Ad5001\BetterGen\populator\TreePopulator;
|
||||
use Ad5001\BetterGen\populator\CactusPopulator;
|
||||
use Ad5001\BetterGen\populator\DeadbushPopulator;
|
||||
use Ad5001\BetterGen\populator\SugarCanePopulator;
|
||||
use Ad5001\BetterGen\populator\TreePopulator;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\GoldOre;
|
||||
use pocketmine\level\generator\normal\biome\SandyBiome;
|
||||
|
||||
class BetterMesa extends SandyBiome {
|
||||
public function __construct() {
|
||||
|
|
|
@ -14,15 +14,13 @@
|
|||
|
||||
namespace Ad5001\BetterGen\biome;
|
||||
|
||||
use pocketmine\level\generator\normal\biome\SandyBiome;
|
||||
use pocketmine\level\generator\object\OreType;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\GoldOre;
|
||||
use Ad5001\BetterGen\Main;
|
||||
use Ad5001\BetterGen\populator\CactusPopulator;
|
||||
use Ad5001\BetterGen\populator\DeadbushPopulator;
|
||||
use Ad5001\BetterGen\populator\SugarCanePopulator;
|
||||
use Ad5001\BetterGen\Main;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\GoldOre;
|
||||
use pocketmine\level\generator\normal\biome\SandyBiome;
|
||||
|
||||
class BetterMesaPlains extends SandyBiome {
|
||||
public function __construct() {
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
namespace Ad5001\BetterGen\biome;
|
||||
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
|
||||
class BetterRiver extends Biome {
|
||||
public function __construct() {
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
*/
|
||||
namespace Ad5001\BetterGen\generator;
|
||||
|
||||
use pocketmine\level\generator\biome\BiomeSelector;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\level\generator\biome\BiomeSelector;
|
||||
use pocketmine\level\generator\noise\Simplex;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class BetterBiomeSelector extends BiomeSelector {
|
||||
|
||||
|
@ -30,7 +30,6 @@ class BetterBiomeSelector extends BiomeSelector {
|
|||
|
||||
/** @var Biome[] */
|
||||
private $biomes = [ ];
|
||||
private $map = [ ];
|
||||
private $lookup;
|
||||
public function __construct(Random $random, callable $lookup, Biome $fallback) {
|
||||
parent::__construct($random, $lookup, $fallback);
|
||||
|
|
|
@ -14,15 +14,18 @@
|
|||
|
||||
namespace Ad5001\BetterGen\generator;
|
||||
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\level\generator\Generator;
|
||||
use pocketmine\level\generator\noise\Simplex;
|
||||
use pocketmine\level\generator\object\OreType;
|
||||
use pocketmine\level\generator\normal\object\OreType as OreType2;
|
||||
use pocketmine\level\generator\populator\Ore;
|
||||
use Ad5001\BetterGen\biome\BetterDesert;
|
||||
use Ad5001\BetterGen\biome\BetterForest;
|
||||
use Ad5001\BetterGen\biome\BetterIcePlains;
|
||||
use Ad5001\BetterGen\biome\BetterMesa;
|
||||
use Ad5001\BetterGen\biome\BetterMesaPlains;
|
||||
use Ad5001\BetterGen\biome\BetterRiver;
|
||||
use Ad5001\BetterGen\biome\Mountainable;
|
||||
use Ad5001\BetterGen\Main;
|
||||
use Ad5001\BetterGen\populator\CavePopulator;
|
||||
use Ad5001\BetterGen\populator\FloatingIslandPopulator;
|
||||
use Ad5001\BetterGen\populator\MineshaftPopulator;
|
||||
use Ad5001\BetterGen\populator\RavinePopulator;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\CoalOre;
|
||||
use pocketmine\block\DiamondOre;
|
||||
|
@ -32,20 +35,15 @@ use pocketmine\block\Gravel;
|
|||
use pocketmine\block\IronOre;
|
||||
use pocketmine\block\LapisOre;
|
||||
use pocketmine\block\RedstoneOre;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\biome\Biome;
|
||||
use pocketmine\level\generator\Generator;
|
||||
use pocketmine\level\generator\noise\Simplex;
|
||||
use pocketmine\level\generator\normal\object\OreType as OreType2;
|
||||
use pocketmine\level\generator\object\OreType;
|
||||
use pocketmine\level\Level;
|
||||
use Ad5001\BetterGen\biome\BetterForest;
|
||||
use Ad5001\BetterGen\biome\BetterDesert;
|
||||
use Ad5001\BetterGen\biome\BetterIcePlains;
|
||||
use Ad5001\BetterGen\biome\BetterMesa;
|
||||
use Ad5001\BetterGen\biome\BetterMesaPlains;
|
||||
use Ad5001\BetterGen\biome\BetterRiver;
|
||||
use Ad5001\BetterGen\biome\Mountainable;
|
||||
use Ad5001\BetterGen\populator\CavePopulator;
|
||||
use Ad5001\BetterGen\populator\RavinePopulator;
|
||||
use Ad5001\BetterGen\populator\LakePopulator;
|
||||
use Ad5001\BetterGen\populator\MineshaftPopulator;
|
||||
use Ad5001\BetterGen\populator\FloatingIslandPopulator;
|
||||
use Ad5001\BetterGen\Main;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class BetterNormal extends Generator {
|
||||
const NOT_OVERWRITABLE = [
|
||||
|
@ -61,9 +59,11 @@ class BetterNormal extends Generator {
|
|||
Block::WATER,
|
||||
Block::STILL_WATER
|
||||
];
|
||||
/** @var BetterBiomeSelector */
|
||||
protected $selector;
|
||||
/** @var Level */
|
||||
protected $level;
|
||||
/** @var Random */
|
||||
protected $random;
|
||||
protected $populators = [ ];
|
||||
protected $generationPopulators = [ ];
|
||||
|
@ -78,6 +78,7 @@ class BetterNormal extends Generator {
|
|||
]
|
||||
];
|
||||
protected $waterHeight = 63;
|
||||
private $noiseBase;
|
||||
|
||||
/*
|
||||
* Picks a biome by X and Z
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
|
||||
namespace Ad5001\BetterGen\loot;
|
||||
|
||||
use pocketmine\inventory\BaseInventory;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\nbt\NBT;
|
||||
use pocketmine\utils\Config;
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\inventory\BaseInventory;
|
||||
use pocketmine\nbt\NBT;
|
||||
|
||||
/*
|
||||
* This class is used for loot setting.
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\level\generator\populator\Populator;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
abstract class AmountPopulator extends Populator {
|
||||
protected $baseAmount = 0;
|
||||
|
|
|
@ -14,13 +14,11 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\structure\Bush;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use Ad5001\BetterGen\populator\TreePopulator;
|
||||
use Ad5001\BetterGen\populator\AmountPopulator;
|
||||
use Ad5001\BetterGen\structure\Bush;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class BushPopulator extends AmountPopulator {
|
||||
/** @var ChunkManager */
|
||||
|
|
|
@ -15,12 +15,11 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use Ad5001\BetterGen\structure\Cactus;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\structure\Cactus;
|
||||
use Ad5001\BetterGen\populator\AmountPopulator;
|
||||
|
||||
class CactusPopulator extends AmountPopulator {
|
||||
/** @var ChunkManager */
|
||||
|
|
|
@ -14,13 +14,12 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\utils\BuildingUtils;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\math\Vector3;
|
||||
use Ad5001\BetterGen\utils\BuildingUtils;
|
||||
use Ad5001\BetterGen\populator\AmountPopulator;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class CavePopulator extends AmountPopulator {
|
||||
/** @var ChunkManager */
|
||||
|
@ -93,7 +92,7 @@ class CavePopulator extends AmountPopulator {
|
|||
foreach($gen = $this->generateBranch($x, $y, $z, 5, 3, 5, $random ) as $v3 ) {
|
||||
$generatedBranches --;
|
||||
if ($generatedBranches <= 0) {
|
||||
$gen->send(self::STOP);
|
||||
$gen->send(self::STOP); // send not found.. @Ad5001 what is that
|
||||
} else {
|
||||
$gen->send(self::CONTINUE);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ use pocketmine\block\Block;
|
|||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\populator\AmountPopulator;
|
||||
|
||||
class DeadbushPopulator extends AmountPopulator {
|
||||
/** @var ChunkManager */
|
||||
|
|
|
@ -14,12 +14,11 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use Ad5001\BetterGen\structure\FallenTree;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\structure\FallenTree;
|
||||
use Ad5001\BetterGen\populator\AmountPopulator;
|
||||
|
||||
|
||||
class FallenTreePopulator extends AmountPopulator {
|
||||
|
|
|
@ -14,22 +14,21 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\format\Chunk;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\generator\BetterNormal;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\generator\object\OreType;
|
||||
use pocketmine\level\generator\normal\object\OreType as OreType2;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\block\CoalOre;
|
||||
use pocketmine\block\IronOre;
|
||||
use pocketmine\block\RedstoneOre;
|
||||
use pocketmine\block\LapisOre;
|
||||
use pocketmine\block\GoldOre;
|
||||
use pocketmine\block\DiamondOre;
|
||||
use Ad5001\BetterGen\Main;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\CoalOre;
|
||||
use pocketmine\block\DiamondOre;
|
||||
use pocketmine\block\GoldOre;
|
||||
use pocketmine\block\IronOre;
|
||||
use pocketmine\block\LapisOre;
|
||||
use pocketmine\block\RedstoneOre;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\normal\object\OreType as OreType2;
|
||||
use pocketmine\level\generator\object\OreType;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
|
||||
class FloatingIslandPopulator extends AmountPopulator {
|
||||
|
@ -162,6 +161,6 @@ class FloatingIslandPopulator extends AmountPopulator {
|
|||
new OreType(new GoldOre (), 2, 8, $pos->y - $height, $pos->y - round($height / 2)),
|
||||
new OreType(new DiamondOre (), 1, 7, $pos->y - $height, $pos->y - round($height / 4))
|
||||
]);
|
||||
$ores->populate($level, $x >> 4, $z >> 4, $random);//x z undefined
|
||||
$ores->populate($level, $pos->x >> 4, $pos->z >> 4, $random);//x z undefined
|
||||
}
|
||||
}
|
|
@ -14,12 +14,11 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\structure\Igloo;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use Ad5001\BetterGen\populator\AmountPopulator;
|
||||
use Ad5001\BetterGen\structure\Igloo;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class IglooPopulator extends AmountPopulator {
|
||||
/** @var ChunkManager */
|
||||
|
|
|
@ -14,13 +14,12 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\utils\BuildingUtils;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\math\Vector3;
|
||||
use Ad5001\BetterGen\utils\BuildingUtils;
|
||||
use Ad5001\BetterGen\populator\AmountPopulator;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class LakePopulator extends AmountPopulator {
|
||||
/** @var ChunkManager */
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\utils\BuildingUtils;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\block\Block;
|
||||
use Ad5001\BetterGen\loot\LootTable;
|
||||
use Ad5001\BetterGen\utils\BuildingUtils;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class MineshaftPopulator extends AmountPopulator {
|
||||
protected $maxPath;
|
||||
|
@ -131,13 +131,13 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
// First, filling everything blank.
|
||||
BuildingUtils::fill($this->level, new Vector3($x, $y, $z - 1 ), new Vector3($x - 4, $y + 2, $z + 1 ));
|
||||
// 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, $level) {
|
||||
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);
|
||||
}, $this->level);
|
||||
// Putting rails
|
||||
BuildingUtils::fillCallback(new Vector3($x, $y, $z ), new Vector3($x - 4, $y, $z ), function ($v3, $level, $random) {
|
||||
BuildingUtils::fillCallback(new Vector3($x, $y, $z ), new Vector3($x - 4, $y, $z ), function ($v3, ChunkManager $level, Random $random) {
|
||||
if ($random->nextBoundedInt(3 ) !== 0) {
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::RAIL);
|
||||
$level->setBlockDataAt($v3->x, $v3->y, $v3->z, 1);
|
||||
|
@ -213,13 +213,13 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
// First, filling everything blank.
|
||||
BuildingUtils::fill($this->level, new Vector3($x - 1, $y, $z ), new Vector3($x + 1, $y + 2, $z - 4 ));
|
||||
// Then, making sure the floor is solid.
|
||||
BuildingUtils::fillCallback(new Vector3($x - 1, $y - 1, $z ), new Vector3($x + 1, $y - 1, $z - 4 ), function ($v3, $level) {
|
||||
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);
|
||||
}, $this->level);
|
||||
// Putting rails
|
||||
BuildingUtils::fillCallback(new Vector3($x, $y, $z ), new Vector3($x, $y, $z - 4 ), function ($v3, $level, $random) {
|
||||
BuildingUtils::fillCallback(new Vector3($x, $y, $z ), new Vector3($x, $y, $z - 4 ), function ($v3, ChunkManager $level, Random $random) {
|
||||
if ($random->nextBoundedInt(3 ) !== 0) {
|
||||
$level->setBlockIdAt($v3->x, $v3->y, $v3->z, Block::RAIL);
|
||||
$level->setBlockDataAt($v3->x, $v3->y, $v3->z, 0);
|
||||
|
@ -310,7 +310,7 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
self::DIR_ZMIN
|
||||
] : [ ])
|
||||
];
|
||||
for($i = 7; $i > $newfloor; $i --) {
|
||||
for($i = 7; $i > $newFloor; $i --) {
|
||||
$chooseNew =(int ) $newFloor && $random->nextBoolean ();
|
||||
$choose = $random->nextBoundedInt(4);
|
||||
unset($possiblePathes [$chooseNew] [$choose]);
|
||||
|
@ -366,17 +366,17 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
}
|
||||
// Building stairs
|
||||
for($i = 0; $i < 4; $i ++) {
|
||||
switch ($path) {
|
||||
switch ($i) {
|
||||
case self::DIR_XPLUS :
|
||||
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, $level) {
|
||||
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);
|
||||
}, $this->level);
|
||||
break;
|
||||
case self::DIR_XMIN :
|
||||
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, $level) {
|
||||
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);
|
||||
|
@ -384,7 +384,7 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
break;
|
||||
case self::DIR_ZPLUS :
|
||||
BuildingUtils::fill($this->level, new Vector3($x - 2, $y - $i - 1, $z + $i ), new Vector3($x + 2, $y - $i + 3, $z + $i ), Block::get(Block::AIR ));
|
||||
BuildingUtils::fillCallback(new Vector3($x - 2, $y - $i - 2, $z + $i ), new Vector3($x + 2, $y - $i - 2, $z + $i ), function ($v3, $level) {
|
||||
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);
|
||||
|
@ -392,7 +392,7 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
break;
|
||||
case self::DIR_ZMIN :
|
||||
BuildingUtils::fill($this->level, new Vector3($x - 2, $y - $i - 1, $z - $i ), new Vector3($x + 2, $y - $i + 3, $z - $i ), Block::get(Block::AIR ));
|
||||
BuildingUtils::fillCallback(new Vector3($x - 2, $y - $i - 2, $z - $i ), new Vector3($x + 2, $y - $i - 2, $z - $i ), function ($v3, $level) {
|
||||
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);
|
||||
|
@ -402,7 +402,7 @@ class MineshaftPopulator extends AmountPopulator {
|
|||
}
|
||||
|
||||
// Next one
|
||||
switch ($path) {
|
||||
switch ($i) {
|
||||
case self::DIR_XPLUS :
|
||||
$this->generateMineshaftPart($x + 4, $y - 4, $z, self::DIR_XPLUS, $random);
|
||||
break;
|
||||
|
|
|
@ -14,12 +14,11 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\utils\BuildingUtils;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use Ad5001\BetterGen\populator\AmountPopulator;
|
||||
use Ad5001\BetterGen\utils\BuildingUtils;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class RavinePopulator extends AmountPopulator {
|
||||
/** @var ChunkManager */
|
||||
|
|
|
@ -14,12 +14,11 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use Ad5001\BetterGen\structure\SugarCane;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\structure\SugarCane;
|
||||
use Ad5001\BetterGen\populator\AmountPopulator;
|
||||
|
||||
class SugarCanePopulator extends AmountPopulator {
|
||||
/** @var ChunkManager */
|
||||
|
|
|
@ -14,12 +14,11 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\structure\Temple;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use Ad5001\BetterGen\structure\Temple;
|
||||
use Ad5001\BetterGen\populator\AmountPopulator;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class TemplePopulator extends AmountPopulator {
|
||||
/** @var Level */
|
||||
|
|
|
@ -14,14 +14,12 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use Ad5001\BetterGen\Main;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\object\Tree;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use Ad5001\BetterGen\structure\SakuraTree;
|
||||
use Ad5001\BetterGen\populator\AmountPopulator;
|
||||
use Ad5001\BetterGen\Main;
|
||||
|
||||
|
||||
class TreePopulator extends AmountPopulator {
|
||||
|
|
|
@ -14,12 +14,11 @@
|
|||
|
||||
namespace Ad5001\BetterGen\populator;
|
||||
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\structure\Well;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use Ad5001\BetterGen\structure\Well;
|
||||
use Ad5001\BetterGen\populator\AmountPopulator;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class WellPopulator extends AmountPopulator {
|
||||
/** @var ChunkManager */
|
||||
|
|
|
@ -14,12 +14,11 @@
|
|||
|
||||
namespace Ad5001\BetterGen\structure;
|
||||
|
||||
use pocketmine\block\Leaves;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class Bush extends Object {
|
||||
public $overridable = [
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
namespace Ad5001\BetterGen\structure;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class Cactus extends Object {
|
||||
|
||||
|
@ -29,10 +29,12 @@ class Cactus extends Object {
|
|||
* @param $z int
|
||||
* @param $random pocketmine\utils\Random
|
||||
*/
|
||||
private $totalHeight;
|
||||
|
||||
public function canPlaceObject(ChunkManager $level, int $x, int $y, int $z, Random $random): bool {
|
||||
$this->totalHeight = 1 + $random->nextBoundedInt(3);
|
||||
$below = $level->getBlockIdAt($x, $y - 1, $z);
|
||||
for($yy = $y; $yy <= $y + $totalHeight; $yy ++) {
|
||||
for($yy = $y; $yy <= $y + $this->totalHeight; $yy ++) {
|
||||
if ($level->getBlockIdAt($x, $yy, $z ) !== Block::AIR || ($below !== Block::SAND && $below !== Block::CACTUS) || ($level->getBlockIdAt($x - 1, $yy, $z ) !== Block::AIR || $level->getBlockIdAt($x + 1, $yy, $z ) !== Block::AIR || $level->getBlockIdAt($x, $yy, $z - 1 ) !== Block::AIR || $level->getBlockIdAt($x, $yy, $z + 1 ) !== Block::AIR)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace Ad5001\BetterGen\structure;
|
|||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class Igloo extends Object {
|
||||
public $overridable = [
|
||||
|
|
|
@ -14,12 +14,14 @@
|
|||
|
||||
namespace Ad5001\BetterGen\structure;
|
||||
|
||||
use Ad5001\BetterGen\Main;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\Wood;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\object\Tree;
|
||||
use pocketmine\utils\Random;
|
||||
use Ad5001\BetterGen\Main;
|
||||
if(Main::isOtherNS()) {
|
||||
|
||||
if (Main::isOtherNS()) {
|
||||
class_alias("pocketmine\\level\\generator\\normal\\object\\Tree", "Ad5001\\BetterGen\\structure\\Tree");
|
||||
} else {
|
||||
class_alias("pocketmine\\level\\generator\\object\\Tree", "Ad5001\\BetterGen\\structure\\Tree");
|
||||
|
@ -63,16 +65,16 @@ class SakuraTree extends Tree {
|
|||
4
|
||||
],
|
||||
[
|
||||
- 4,
|
||||
-4,
|
||||
4
|
||||
],
|
||||
[
|
||||
4,
|
||||
- 4
|
||||
-4
|
||||
],
|
||||
[
|
||||
- 4,
|
||||
- 4
|
||||
-4,
|
||||
-4
|
||||
]
|
||||
],
|
||||
8 => [
|
||||
|
@ -81,16 +83,16 @@ class SakuraTree extends Tree {
|
|||
6
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
-6,
|
||||
6
|
||||
],
|
||||
[
|
||||
6,
|
||||
- 6
|
||||
-6
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
- 6
|
||||
-6,
|
||||
-6
|
||||
]
|
||||
],
|
||||
9 => [
|
||||
|
@ -99,16 +101,16 @@ class SakuraTree extends Tree {
|
|||
6
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
-6,
|
||||
6
|
||||
],
|
||||
[
|
||||
6,
|
||||
- 6
|
||||
-6
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
- 6
|
||||
-6,
|
||||
-6
|
||||
]
|
||||
],
|
||||
10 => [
|
||||
|
@ -117,16 +119,16 @@ class SakuraTree extends Tree {
|
|||
6
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
-6,
|
||||
6
|
||||
],
|
||||
[
|
||||
6,
|
||||
- 6
|
||||
-6
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
- 6
|
||||
-6,
|
||||
-6
|
||||
]
|
||||
],
|
||||
11 => [
|
||||
|
@ -143,40 +145,40 @@ class SakuraTree extends Tree {
|
|||
6
|
||||
],
|
||||
[
|
||||
- 7,
|
||||
-7,
|
||||
7
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
-6,
|
||||
8
|
||||
],
|
||||
[
|
||||
- 8,
|
||||
-8,
|
||||
6
|
||||
],
|
||||
[
|
||||
7,
|
||||
- 7
|
||||
-7
|
||||
],
|
||||
[
|
||||
6,
|
||||
- 8
|
||||
-8
|
||||
],
|
||||
[
|
||||
8,
|
||||
- 6
|
||||
-6
|
||||
],
|
||||
[
|
||||
- 7,
|
||||
- 7
|
||||
-7,
|
||||
-7
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
- 8
|
||||
-6,
|
||||
-8
|
||||
],
|
||||
[
|
||||
- 8,
|
||||
- 6
|
||||
-8,
|
||||
-6
|
||||
]
|
||||
],
|
||||
12 => [
|
||||
|
@ -193,40 +195,40 @@ class SakuraTree extends Tree {
|
|||
6
|
||||
],
|
||||
[
|
||||
- 7,
|
||||
-7,
|
||||
7
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
-6,
|
||||
8
|
||||
],
|
||||
[
|
||||
- 8,
|
||||
-8,
|
||||
6
|
||||
],
|
||||
[
|
||||
7,
|
||||
- 7
|
||||
-7
|
||||
],
|
||||
[
|
||||
6,
|
||||
- 8
|
||||
-8
|
||||
],
|
||||
[
|
||||
8,
|
||||
- 6
|
||||
-6
|
||||
],
|
||||
[
|
||||
- 7,
|
||||
- 7
|
||||
-7,
|
||||
-7
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
- 8
|
||||
-6,
|
||||
-8
|
||||
],
|
||||
[
|
||||
- 8,
|
||||
- 6
|
||||
-8,
|
||||
-6
|
||||
]
|
||||
],
|
||||
13 => [
|
||||
|
@ -243,48 +245,48 @@ class SakuraTree extends Tree {
|
|||
6
|
||||
],
|
||||
[
|
||||
- 7,
|
||||
-7,
|
||||
7
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
-6,
|
||||
8
|
||||
],
|
||||
[
|
||||
- 8,
|
||||
-8,
|
||||
6
|
||||
],
|
||||
[
|
||||
7,
|
||||
- 7
|
||||
-7
|
||||
],
|
||||
[
|
||||
6,
|
||||
- 8
|
||||
-8
|
||||
],
|
||||
[
|
||||
8,
|
||||
- 6
|
||||
-6
|
||||
],
|
||||
[
|
||||
- 7,
|
||||
- 7
|
||||
-7,
|
||||
-7
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
- 8
|
||||
-6,
|
||||
-8
|
||||
],
|
||||
[
|
||||
- 8,
|
||||
- 6
|
||||
-8,
|
||||
-6
|
||||
]
|
||||
]
|
||||
];
|
||||
const ADDITIONAL_BLOCKS = [ // Blocks who aren't set to fully fill the tree. X relative to $lastX and Z from $lastZ
|
||||
7 => [ ],
|
||||
8 => [ ],
|
||||
9 => [ ],
|
||||
10 => [ ],
|
||||
7 => [],
|
||||
8 => [],
|
||||
9 => [],
|
||||
10 => [],
|
||||
11 => [
|
||||
[
|
||||
6,
|
||||
|
@ -299,40 +301,40 @@ class SakuraTree extends Tree {
|
|||
7
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
-6,
|
||||
6
|
||||
],
|
||||
[
|
||||
- 7,
|
||||
-7,
|
||||
6
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
-6,
|
||||
7
|
||||
],
|
||||
[
|
||||
6,
|
||||
- 6
|
||||
-6
|
||||
],
|
||||
[
|
||||
7,
|
||||
- 6
|
||||
-6
|
||||
],
|
||||
[
|
||||
6,
|
||||
- 7
|
||||
-7
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
- 6
|
||||
-6,
|
||||
-6
|
||||
],
|
||||
[
|
||||
- 7,
|
||||
- 6
|
||||
-7,
|
||||
-6
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
- 7
|
||||
-6,
|
||||
-7
|
||||
]
|
||||
],
|
||||
12 => [
|
||||
|
@ -349,40 +351,40 @@ class SakuraTree extends Tree {
|
|||
7
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
-6,
|
||||
6
|
||||
],
|
||||
[
|
||||
- 7,
|
||||
-7,
|
||||
6
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
-6,
|
||||
7
|
||||
],
|
||||
[
|
||||
6,
|
||||
- 6
|
||||
-6
|
||||
],
|
||||
[
|
||||
7,
|
||||
- 6
|
||||
-6
|
||||
],
|
||||
[
|
||||
6,
|
||||
- 7
|
||||
-7
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
- 6
|
||||
-6,
|
||||
-6
|
||||
],
|
||||
[
|
||||
- 7,
|
||||
- 6
|
||||
-7,
|
||||
-6
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
- 7
|
||||
-6,
|
||||
-7
|
||||
]
|
||||
],
|
||||
13 => [
|
||||
|
@ -399,40 +401,40 @@ class SakuraTree extends Tree {
|
|||
7
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
-6,
|
||||
6
|
||||
],
|
||||
[
|
||||
- 7,
|
||||
-7,
|
||||
6
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
-6,
|
||||
7
|
||||
],
|
||||
[
|
||||
6,
|
||||
- 6
|
||||
-6
|
||||
],
|
||||
[
|
||||
7,
|
||||
- 6
|
||||
-6
|
||||
],
|
||||
[
|
||||
6,
|
||||
- 7
|
||||
-7
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
- 6
|
||||
-6,
|
||||
-6
|
||||
],
|
||||
[
|
||||
- 7,
|
||||
- 6
|
||||
-7,
|
||||
-6
|
||||
],
|
||||
[
|
||||
- 6,
|
||||
- 7
|
||||
-6,
|
||||
-7
|
||||
]
|
||||
]
|
||||
];
|
||||
|
@ -440,6 +442,8 @@ class SakuraTree extends Tree {
|
|||
|
||||
|
||||
public $trunkHeight = 11;
|
||||
private $leafType;
|
||||
private $leaf2Type;
|
||||
|
||||
/*
|
||||
* Constructs the class
|
||||
|
@ -467,6 +471,8 @@ class SakuraTree extends Tree {
|
|||
}
|
||||
$trunkHeight = 7 + $random->nextBoundedInt(7);
|
||||
|
||||
$xDiff = $zDiff = 0;
|
||||
|
||||
$direction = $random->nextBoundedInt(3); // Choosing building north east west south
|
||||
switch ($direction) {
|
||||
case 0 :
|
||||
|
@ -486,10 +492,10 @@ 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 ) = [
|
||||
list($lastX, $lastY, $lastZ) = [
|
||||
$x,
|
||||
$y,
|
||||
$z
|
||||
|
@ -497,9 +503,9 @@ class SakuraTree extends Tree {
|
|||
|
||||
// Filling horizontally
|
||||
if ($hParts > 0) {
|
||||
for($i = 0; $i < $hParts; $i ++) {
|
||||
for ($i = 0; $i < $hParts; $i++) {
|
||||
$lastX += $xDiff * 2;
|
||||
$lastY ++;
|
||||
$lastY++;
|
||||
$lastZ += $zDiff * 2;
|
||||
$this->setLog($level, $lastX - $xDiff, $lastY, $lastZ - $zDiff);
|
||||
$this->setLog($level, $lastX, $lastY, $lastZ);
|
||||
|
@ -508,13 +514,13 @@ class SakuraTree extends Tree {
|
|||
|
||||
// The middle block
|
||||
$lastX += $xDiff;
|
||||
$lastY ++;
|
||||
$lastY++;
|
||||
$lastZ += $zDiff;
|
||||
$this->setLog($level, $lastX, $lastY, $lastZ);
|
||||
|
||||
// Filling vertically
|
||||
if ($vParts > 0) {
|
||||
for($i = 0; $i < $vParts; $i ++) {
|
||||
for ($i = 0; $i < $vParts; $i++) {
|
||||
$lastX += $xDiff;
|
||||
$lastY += 2;
|
||||
$lastZ += $zDiff;
|
||||
|
@ -524,18 +530,20 @@ class SakuraTree extends Tree {
|
|||
}
|
||||
// Filling the top trunk.
|
||||
$lastX += $xDiff;
|
||||
$lastY ++;
|
||||
$lastY++;
|
||||
$lastZ += $zDiff;
|
||||
for($i = 0; $i < 4; $i ++) {
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$this->setLog($level, $lastX, $lastY + $i, $lastZ);
|
||||
}
|
||||
$lastY ++;
|
||||
$lastY++;
|
||||
// Filling the branches.
|
||||
$branchLen2 = function ($base) {
|
||||
return ceil($base / 2);
|
||||
};
|
||||
|
||||
for($dir = 0; $dir < 4; $dir ++) {
|
||||
$xd = $zd = 0;
|
||||
|
||||
for ($dir = 0; $dir < 4; $dir++) {
|
||||
switch ($dir) {
|
||||
case 0 :
|
||||
$xd = 0;
|
||||
|
@ -560,16 +568,21 @@ class SakuraTree extends Tree {
|
|||
$totalLength = $stickLen + $stickLen2; // Length of the stick
|
||||
$sideLen = $totalLength ** 2; // Side length
|
||||
|
||||
//TODO CHECK WHAT THIS IS SUPPOSED TO BE
|
||||
$numForward = 0;
|
||||
//TODO END
|
||||
$lX1 = $lZ1 = $lX = $lZ = 0;
|
||||
|
||||
// First branch part + first leave part
|
||||
for($i = 1; $i < $stickLen + 1; $i ++) {
|
||||
for ($i = 1; $i < $stickLen + 1; $i++) {
|
||||
$lX1 = $lastX + ($xd * $i);
|
||||
$lZ1 = $lastZ + ($zd * $i);
|
||||
if ($zd !== 0)
|
||||
for($x = $lX1 - $numForward; $x !== $lX1 + $numForward + 1; $x ++) {
|
||||
for ($x = $lX1 - $numForward; $x !== $lX1 + $numForward + 1; $x++) {
|
||||
$this->setLeave($level, $x, $lastY + 3, $lZ1, $random);
|
||||
}
|
||||
if ($xd !== 0)
|
||||
for($z = $lZ1 - $numForward; $z !== $lZ1 + $numForward + 1; $z ++) {
|
||||
for ($z = $lZ1 - $numForward; $z !== $lZ1 + $numForward + 1; $z++) {
|
||||
$this->setLeave($level, $lX1, $lastY + 3, $z, $random);
|
||||
}
|
||||
$this->setLog($level, $lX1, $lastY, $lZ1);
|
||||
|
@ -577,15 +590,15 @@ class SakuraTree extends Tree {
|
|||
|
||||
// Second branch part. + second leave part
|
||||
$numForward = ($totalLength % 2 == 0) ? $totalLength - 1 : $totalLength;
|
||||
for($i = 1; $i < $stickLen + 1; $i ++) {
|
||||
for ($i = 1; $i < $stickLen + 1; $i++) {
|
||||
$lX = $lX1 + ($xd * $i);
|
||||
$lZ = $lZ1 + ($zd * $i);
|
||||
if ($zd !== 0)
|
||||
for($x = $lX - $numForward; $x !== $lX + $numForward + 1; $x ++) {
|
||||
for ($x = $lX - $numForward; $x !== $lX + $numForward + 1; $x++) {
|
||||
$this->setLeave($level, $x, $lastY + 2, $lZ, $random);
|
||||
}
|
||||
if ($xd !== 0)
|
||||
for($z = $lZ - $numForward; $z !== $lZ + $numForward + 1; $z ++) {
|
||||
for ($z = $lZ - $numForward; $z !== $lZ + $numForward + 1; $z++) {
|
||||
$this->setLeave($level, $lX, $lastY + 2, $z, $random);
|
||||
}
|
||||
$this->setLog($level, $lX, $lastY + 1, $lZ);
|
||||
|
@ -595,15 +608,15 @@ class SakuraTree extends Tree {
|
|||
$lZ += $zd;
|
||||
// Leaves falling from the tree forward
|
||||
if ($lastZ !== $lZ) { // Z has changed, using X for setting
|
||||
for($x = $lX - $numForward; $x <= $lX + $numForward; $x ++) {
|
||||
$numDown = $random->nextBoundedInt(3 ) + 1;
|
||||
for($y = $lastY + 1; $y > $lastY - $numDown; $y --)
|
||||
for ($x = $lX - $numForward; $x <= $lX + $numForward; $x++) {
|
||||
$numDown = $random->nextBoundedInt(3) + 1;
|
||||
for ($y = $lastY + 1; $y > $lastY - $numDown; $y--)
|
||||
$this->setLeave($level, $x, $y, $lZ, $random);
|
||||
}
|
||||
} else { // Z have stayed, X has changed
|
||||
for($z = $lZ - $numForward; $z <= $lZ + $numForward; $z ++) {
|
||||
$numDown = $random->nextBoundedInt(3 ) + 1;
|
||||
for($y = $lastY + 1; $y > $lastY + 1 - $numDown; $y --)
|
||||
for ($z = $lZ - $numForward; $z <= $lZ + $numForward; $z++) {
|
||||
$numDown = $random->nextBoundedInt(3) + 1;
|
||||
for ($y = $lastY + 1; $y > $lastY + 1 - $numDown; $y--)
|
||||
$this->setLeave($level, $lX, $y, $z, $random);
|
||||
}
|
||||
}
|
||||
|
@ -630,14 +643,14 @@ class SakuraTree extends Tree {
|
|||
}
|
||||
|
||||
// Leaves falling from the tree diagonally
|
||||
foreach(self::DIAG_LEAVES [$trunkHeight] as $pos ) {
|
||||
$numDown = $random->nextBoundedInt(3 ) + 1;
|
||||
for($y = $lastY + 1; $y > $lastY - $numDown; $y --)
|
||||
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);
|
||||
}
|
||||
|
||||
// Additional leaves
|
||||
foreach(self::ADDITIONAL_BLOCKS [$trunkHeight] as $pos ) {
|
||||
foreach (self::ADDITIONAL_BLOCKS [$trunkHeight] as $pos) {
|
||||
$this->setLeave($level, $lastX + $pos [0], $lastY + 2, $lastZ + $pos [1], $random);
|
||||
}
|
||||
}
|
||||
|
@ -667,7 +680,7 @@ class SakuraTree extends Tree {
|
|||
$data = [
|
||||
$this->leafType,
|
||||
$this->leaf2Type
|
||||
] [( int ) $random->nextBoolean ()];
|
||||
] [( int )$random->nextBoolean()];
|
||||
$level->setBlockIdAt($x, $y, $z, $this->leafBlock);
|
||||
$level->setBlockDataAt($x, $y, $z, $data);
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
namespace Ad5001\BetterGen\structure;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class SugarCane extends Object {
|
||||
|
||||
|
@ -30,6 +30,8 @@ class SugarCane extends Object {
|
|||
* @param $z int
|
||||
* @param $random pocketmine\utils\Random
|
||||
*/
|
||||
private $totalHeight;
|
||||
|
||||
public function canPlaceObject(ChunkManager $level, int $x, int $y, int $z, Random $random): bool {
|
||||
$this->totalHeight = 1 + $random->nextBoundedInt(3);
|
||||
$below = $level->getBlockIdAt($x, $y - 1, $z);
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
|
||||
namespace Ad5001\BetterGen\structure;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use Ad5001\BetterGen\loot\LootTable;
|
||||
use Ad5001\BetterGen\utils\BuildingUtils;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class Temple extends Object {
|
||||
const DIRECTION_PLUSX = 0;
|
||||
|
@ -109,6 +109,7 @@ class Temple extends Object {
|
|||
1
|
||||
]
|
||||
];
|
||||
private $direction;
|
||||
|
||||
/*
|
||||
* Checks if a temple is placeable
|
||||
|
|
|
@ -17,8 +17,8 @@ namespace Ad5001\BetterGen\structure;
|
|||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\level\generator\object\Object;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
|
||||
class Well extends Object {
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
namespace Ad5001\BetterGen\utils;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
class BuildingUtils {
|
||||
|
|
Loading…
Reference in a new issue