mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Separate BannerPatternLayer from BannerPatternType
This commit is contained in:
@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||
namespace pocketmine\block;
|
||||
|
||||
use pocketmine\block\tile\Banner as TileBanner;
|
||||
use pocketmine\block\utils\BannerPattern;
|
||||
use pocketmine\block\utils\BannerPatternLayer;
|
||||
use pocketmine\block\utils\DyeColor;
|
||||
use pocketmine\data\bedrock\DyeColorIdMap;
|
||||
use pocketmine\item\Banner as ItemBanner;
|
||||
@ -44,8 +44,8 @@ abstract class BaseBanner extends Transparent{
|
||||
protected $baseColor;
|
||||
|
||||
/**
|
||||
* @var BannerPattern[]
|
||||
* @phpstan-var list<BannerPattern>
|
||||
* @var BannerPatternLayer[]
|
||||
* @phpstan-var list<BannerPatternLayer>
|
||||
*/
|
||||
protected $patterns = [];
|
||||
|
||||
@ -83,22 +83,23 @@ abstract class BaseBanner extends Transparent{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BannerPattern[]
|
||||
* @phpstan-return list<BannerPattern>
|
||||
* @return BannerPatternLayer[]
|
||||
* @phpstan-return list<BannerPatternLayer>
|
||||
*/
|
||||
public function getPatterns() : array{
|
||||
return $this->patterns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BannerPattern[] $patterns
|
||||
* @phpstan-param list<BannerPattern> $patterns
|
||||
* @param BannerPatternLayer[] $patterns
|
||||
*
|
||||
* @phpstan-param list<BannerPatternLayer> $patterns
|
||||
* @return $this
|
||||
*/
|
||||
public function setPatterns(array $patterns) : self{
|
||||
$checked = array_filter($patterns, fn($v) => $v instanceof BannerPattern);
|
||||
$checked = array_filter($patterns, fn($v) => $v instanceof BannerPatternLayer);
|
||||
if(count($checked) !== count($patterns)){
|
||||
throw new \TypeError("Deque must only contain " . BannerPattern::class . " objects");
|
||||
throw new \TypeError("Deque must only contain " . BannerPatternLayer::class . " objects");
|
||||
}
|
||||
$this->patterns = $checked;
|
||||
return $this;
|
||||
|
Reference in New Issue
Block a user