PocketMine-MP
5.32.2 git-237b304ef9858756b018e44e8f298093f66f823b
Loading...
Searching...
No Matches
Wood.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\block
;
25
26
use
pocketmine\block\utils\PillarRotation
;
27
use pocketmine\block\utils\PillarRotationTrait;
28
use
pocketmine\block\utils\WoodMaterial
;
29
use pocketmine\block\utils\WoodTypeTrait;
30
use
pocketmine\data\runtime\RuntimeDataDescriber
;
31
use
pocketmine\item\Axe
;
32
use
pocketmine\item\Item
;
33
use
pocketmine\math\Vector3
;
34
use
pocketmine\player\Player
;
35
use
pocketmine\world\sound\ItemUseOnBlockSound
;
36
37
class
Wood
extends
Opaque
implements
PillarRotation
,
WoodMaterial
{
38
use PillarRotationTrait;
39
use WoodTypeTrait;
40
41
private
bool
$stripped =
false
;
42
43
public
function
describeBlockItemState
(
RuntimeDataDescriber
$w) : void{
44
$w->bool($this->stripped);
45
}
46
47
public
function
isStripped() : bool{ return $this->stripped; }
48
50
public
function
setStripped
(
bool
$stripped) : self{
51
$this->stripped = $stripped;
52
return
$this;
53
}
54
55
public
function
getFuelTime
() : int{
56
return $this->woodType->isFlammable() ? 300 : 0;
57
}
58
59
public
function
getFlameEncouragement
() : int{
60
return $this->woodType->isFlammable() ? 5 : 0;
61
}
62
63
public
function
getFlammability
() : int{
64
return $this->woodType->isFlammable() ? 5 : 0;
65
}
66
67
public
function
onInteract
(
Item
$item,
int
$face,
Vector3
$clickVector, ?
Player
$player =
null
, array &$returnedItems = []) : bool{
68
if(!$this->stripped && $item instanceof
Axe
){
69
$item->applyDamage(1);
70
$this->stripped =
true
;
71
$this->position->getWorld()->setBlock($this->position, $this);
72
$this->position->getWorld()->addSound($this->position,
new
ItemUseOnBlockSound
($this));
73
return
true
;
74
}
75
return
false
;
76
}
77
}
pocketmine\block\Opaque
Definition
Opaque.php:30
pocketmine\block\Wood
Definition
Wood.php:37
pocketmine\block\Wood\getFuelTime
getFuelTime()
Definition
Wood.php:55
pocketmine\block\Wood\onInteract
onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player=null, array &$returnedItems=[])
Definition
Wood.php:67
pocketmine\block\Wood\describeBlockItemState
describeBlockItemState(RuntimeDataDescriber $w)
Definition
Wood.php:43
pocketmine\block\Wood\getFlameEncouragement
getFlameEncouragement()
Definition
Wood.php:59
pocketmine\block\Wood\setStripped
setStripped(bool $stripped)
Definition
Wood.php:50
pocketmine\block\Wood\getFlammability
getFlammability()
Definition
Wood.php:63
pocketmine\item\Axe
Definition
Axe.php:30
pocketmine\item\Item
Definition
Item.php:60
pocketmine\math\Vector3
Definition
Vector3.php:36
pocketmine\player\Player
Definition
Player.php:173
pocketmine\world\sound\ItemUseOnBlockSound
Definition
ItemUseOnBlockSound.php:32
pocketmine\block\utils\PillarRotation
Definition
PillarRotation.php:28
pocketmine\block\utils\WoodMaterial
Definition
WoodMaterial.php:26
pocketmine\data\runtime\RuntimeDataDescriber
Definition
RuntimeDataDescriber.php:37
pocketmine\block
Definition
ActivatorRail.php:24
src
block
Wood.php
Generated by
1.12.0