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,21 +232,18 @@ 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),
|
||||
new IntTag("x", $event->getBlock()->x),
|
||||
new IntTag("y", $event->getBlock()->y),
|
||||
new IntTag("z", $event->getBlock()->z)
|
||||
new ListTag("Items", []),
|
||||
new StringTag("id", Tile::CHEST),
|
||||
new IntTag("x", $event->getBlock()->x),
|
||||
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 = [
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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