color = $color; } /** * @return DyeColor */ public function getColor() : DyeColor{ return $this->color; } public function getBlock() : Block{ return VanillaBlocks::BANNER(); } public function getMaxStackSize() : int{ return 16; } /** * @return Deque|BannerPattern[] */ public function getPatterns() : Deque{ $result = new Deque(); $tag = $this->getNamedTag()->getListTag(self::TAG_PATTERNS); if($tag !== null){ /** @var CompoundTag $t */ foreach($tag as $t){ $result->push(new BannerPattern($t->getString(self::TAG_PATTERN_NAME), DyeColor::fromMagicNumber($t->getInt(self::TAG_PATTERN_COLOR), true))); } } return $result; } /** * @param Deque|BannerPattern[] $patterns * * @return $this */ public function setPatterns(Deque $patterns) : self{ $tag = new ListTag(); /** @var BannerPattern $pattern */ foreach($patterns as $pattern){ $tag->push(CompoundTag::create() ->setString(self::TAG_PATTERN_NAME, $pattern->getId()) ->setInt(self::TAG_PATTERN_COLOR, $pattern->getColor()->getInvertedMagicNumber()) ); } $this->getNamedTag()->setTag(self::TAG_PATTERNS, $tag); return $this; } public function getFuelTime() : int{ return 300; } }