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