PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
CoralFan.php
1<?php
2
3/*
4 *
5 * ____ _ _ __ __ _ __ __ ____
6 * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8 * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9 * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * @author PocketMine Team
17 * @link http://www.pocketmine.net/
18 *
19 *
20 */
21
22declare(strict_types=1);
23
24namespace pocketmine\item;
25
27use pocketmine\block\utils\CoralTypeTrait;
32
33final class CoralFan extends Item{
34 use CoralTypeTrait {
35 describeBlockItemState as encodeCoralType;
36 }
37
38 public function __construct(ItemIdentifier $identifier){
39 parent::__construct($identifier, VanillaBlocks::CORAL_FAN()->getName());
40 }
41
42 protected function describeState(RuntimeDataDescriber $w) : void{
43 //this is aliased to ensure a compile error in case the functions in Item or Block start to differ in future
44 //right now we can directly reuse encodeType from CoralTypeTrait, but that might silently stop working if Item
45 //were to be altered. CoralTypeTrait was originally intended for blocks, so it's better not to assume anything.
46 $this->encodeCoralType($w);
47 }
48
49 public function getBlock(?int $clickedFace = null) : Block{
50 $block = $clickedFace !== null && Facing::axis($clickedFace) !== Axis::Y ? VanillaBlocks::WALL_CORAL_FAN() : VanillaBlocks::CORAL_FAN();
51
52 return $block->setCoralType($this->coralType)->setDead($this->dead);
53 }
54
55 public function getFuelTime() : int{
56 return $this->getBlock()->getFuelTime();
57 }
58
59 public function getMaxStackSize() : int{
60 return $this->getBlock()->getMaxStackSize();
61 }
62}
describeState(RuntimeDataDescriber $w)
Definition CoralFan.php:42
getBlock(?int $clickedFace=null)
Definition CoralFan.php:49