mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Move TreeType to generator package, added dedicated SaplingType enum
TreeType includes a bunch of stuff that don't have regular saplings associated with them, such as mangrove and azalea trees. Mangrove has a dedicated propagule block with different behaviour than the others, and azalea trees are grown from azalea blocks, which are solid and have different behaviour to saplings. We may also want to account for crimson and warped 'trees' in TreeType too, although I'm not sure if those belong there or not.
This commit is contained in:
@ -23,9 +23,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\world\biome;
|
||||
|
||||
use pocketmine\block\utils\TreeType;
|
||||
use pocketmine\data\bedrock\BiomeIds;
|
||||
use pocketmine\utils\SingletonTrait;
|
||||
use pocketmine\world\generator\object\TreeType;
|
||||
|
||||
final class BiomeRegistry{
|
||||
use SingletonTrait;
|
||||
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\world\biome;
|
||||
|
||||
use pocketmine\block\utils\TreeType;
|
||||
use pocketmine\world\generator\object\TreeType;
|
||||
use pocketmine\world\generator\populator\TallGrass;
|
||||
use pocketmine\world\generator\populator\Tree;
|
||||
|
||||
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\world\biome;
|
||||
|
||||
use pocketmine\block\utils\TreeType;
|
||||
use pocketmine\world\generator\object\TreeType;
|
||||
use pocketmine\world\generator\populator\TallGrass;
|
||||
use pocketmine\world\generator\populator\Tree;
|
||||
|
||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\world\generator\object;
|
||||
|
||||
use pocketmine\block\utils\TreeType;
|
||||
use pocketmine\utils\Random;
|
||||
|
||||
final class TreeFactory{
|
||||
|
71
src/world/generator/object/TreeType.php
Normal file
71
src/world/generator/object/TreeType.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\world\generator\object;
|
||||
|
||||
use pocketmine\utils\EnumTrait;
|
||||
|
||||
/**
|
||||
* This doc-block is generated automatically, do not modify it manually.
|
||||
* This must be regenerated whenever registry members are added, removed or changed.
|
||||
* @see build/generate-registry-annotations.php
|
||||
* @generate-registry-docblock
|
||||
*
|
||||
* @method static TreeType ACACIA()
|
||||
* @method static TreeType BIRCH()
|
||||
* @method static TreeType DARK_OAK()
|
||||
* @method static TreeType JUNGLE()
|
||||
* @method static TreeType OAK()
|
||||
* @method static TreeType SPRUCE()
|
||||
*/
|
||||
final class TreeType{
|
||||
use EnumTrait {
|
||||
register as Enum_register;
|
||||
__construct as Enum___construct;
|
||||
}
|
||||
|
||||
protected static function setup() : void{
|
||||
self::registerAll(
|
||||
new TreeType("oak", "Oak"),
|
||||
new TreeType("spruce", "Spruce"),
|
||||
new TreeType("birch", "Birch"),
|
||||
new TreeType("jungle", "Jungle"),
|
||||
new TreeType("acacia", "Acacia"),
|
||||
new TreeType("dark_oak", "Dark Oak"),
|
||||
//TODO: cherry blossom, mangrove, azalea
|
||||
//TODO: do crimson and warped "trees" belong here? I'm not sure if they're actually trees or just fungi
|
||||
//TODO: perhaps huge mushrooms should be here too???
|
||||
);
|
||||
}
|
||||
|
||||
private function __construct(
|
||||
string $enumName,
|
||||
private string $displayName
|
||||
){
|
||||
$this->Enum___construct($enumName);
|
||||
}
|
||||
|
||||
public function getDisplayName() : string{
|
||||
return $this->displayName;
|
||||
}
|
||||
}
|
@ -25,11 +25,11 @@ namespace pocketmine\world\generator\populator;
|
||||
|
||||
use pocketmine\block\BlockTypeIds;
|
||||
use pocketmine\block\BlockTypeTags;
|
||||
use pocketmine\block\utils\TreeType;
|
||||
use pocketmine\utils\Random;
|
||||
use pocketmine\world\ChunkManager;
|
||||
use pocketmine\world\format\Chunk;
|
||||
use pocketmine\world\generator\object\TreeFactory;
|
||||
use pocketmine\world\generator\object\TreeType;
|
||||
|
||||
class Tree implements Populator{
|
||||
private int $randomAmount = 1;
|
||||
|
Reference in New Issue
Block a user