PocketMine-MP
5.32.2 git-237b304ef9858756b018e44e8f298093f66f823b
Loading...
Searching...
No Matches
CopperBulb.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\CopperMaterial
;
27
use pocketmine\block\utils\CopperOxidation;
28
use pocketmine\block\utils\CopperTrait;
29
use
pocketmine\block\utils\Lightable
;
30
use pocketmine\block\utils\LightableTrait;
31
use
pocketmine\block\utils\PoweredByRedstone
;
32
use pocketmine\block\utils\PoweredByRedstoneTrait;
33
use
pocketmine\data\runtime\RuntimeDataDescriber
;
34
35
class
CopperBulb
extends
Opaque
implements
CopperMaterial
,
Lightable
,
PoweredByRedstone
{
36
use CopperTrait;
37
use PoweredByRedstoneTrait;
38
use LightableTrait{
39
describeBlockOnlyState
as encodeLitState;
40
}
41
42
protected
function
describeBlockOnlyState
(
RuntimeDataDescriber
$w) : void{
43
$this->encodeLitState($w);
44
$w->bool($this->powered);
45
}
46
48
public
function
togglePowered
(
bool
$powered) : self{
49
if($powered === $this->powered){
50
return
$this;
51
}
52
if
($powered) {
53
$this->setLit(!$this->lit);
54
}
55
$this->setPowered($powered);
56
return
$this;
57
}
58
59
public
function
getLightLevel
() : int{
60
if ($this->lit) {
61
return
match($this->oxidation){
62
CopperOxidation::NONE => 15,
63
CopperOxidation::EXPOSED => 12,
64
CopperOxidation::WEATHERED => 8,
65
CopperOxidation::OXIDIZED => 4,
66
};
67
}
68
69
return
0;
70
}
71
}
pocketmine\block\CopperBulb
Definition
CopperBulb.php:35
pocketmine\block\CopperBulb\describeBlockOnlyState
describeBlockOnlyState(RuntimeDataDescriber $w)
Definition
CopperBulb.php:42
pocketmine\block\CopperBulb\togglePowered
togglePowered(bool $powered)
Definition
CopperBulb.php:48
pocketmine\block\CopperBulb\getLightLevel
getLightLevel()
Definition
CopperBulb.php:59
pocketmine\block\Opaque
Definition
Opaque.php:30
pocketmine\block\utils\CopperMaterial
Definition
CopperMaterial.php:29
pocketmine\block\utils\Lightable
Definition
Lightable.php:26
pocketmine\block\utils\PoweredByRedstone
Definition
PoweredByRedstone.php:26
pocketmine\data\runtime\RuntimeDataDescriber
Definition
RuntimeDataDescriber.php:37
pocketmine\block
Definition
ActivatorRail.php:24
src
block
CopperBulb.php
Generated by
1.12.0