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
22
declare(strict_types=1);
23
24
namespace
pocketmine\item
;
25
26
use
pocketmine\block\Block
;
27
use pocketmine\block\utils\CoralTypeTrait;
28
use
pocketmine\block\VanillaBlocks
;
29
use
pocketmine\data\runtime\RuntimeDataDescriber
;
30
use
pocketmine\math\Axis
;
31
use
pocketmine\math\Facing
;
32
33
final
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
}
pocketmine\block\Block
Definition
Block.php:62
pocketmine\block\VanillaBlocks
Definition
VanillaBlocks.php:793
pocketmine\item\CoralFan
Definition
CoralFan.php:33
pocketmine\item\CoralFan\getMaxStackSize
getMaxStackSize()
Definition
CoralFan.php:59
pocketmine\item\CoralFan\describeState
describeState(RuntimeDataDescriber $w)
Definition
CoralFan.php:42
pocketmine\item\CoralFan\getFuelTime
getFuelTime()
Definition
CoralFan.php:55
pocketmine\item\CoralFan\getBlock
getBlock(?int $clickedFace=null)
Definition
CoralFan.php:49
pocketmine\item\Item
Definition
Item.php:60
pocketmine\item\Item\getName
getName()
Definition
Item.php:450
pocketmine\item\ItemIdentifier
Definition
ItemIdentifier.php:28
pocketmine\math\Axis
Definition
Axis.php:26
pocketmine\math\Facing
Definition
Facing.php:28
pocketmine\data\runtime\RuntimeDataDescriber
Definition
RuntimeDataDescriber.php:38
pocketmine\item
Definition
Apple.php:24
src
item
CoralFan.php
Generated by
1.12.0