mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 00:59:51 +00:00
Added isPressed() and setPressed() to PressurePlate
This commit is contained in:
parent
7c1f0ecb8b
commit
ce855f2133
@ -26,17 +26,25 @@ namespace pocketmine\block;
|
|||||||
abstract class SimplePressurePlate extends PressurePlate{
|
abstract class SimplePressurePlate extends PressurePlate{
|
||||||
|
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
protected $powered = false;
|
protected $pressed = false;
|
||||||
|
|
||||||
protected function writeStateToMeta() : int{
|
protected function writeStateToMeta() : int{
|
||||||
return $this->powered ? BlockLegacyMetadata::PRESSURE_PLATE_FLAG_POWERED : 0;
|
return $this->pressed ? BlockLegacyMetadata::PRESSURE_PLATE_FLAG_POWERED : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||||
$this->powered = ($stateMeta & BlockLegacyMetadata::PRESSURE_PLATE_FLAG_POWERED) !== 0;
|
$this->pressed = ($stateMeta & BlockLegacyMetadata::PRESSURE_PLATE_FLAG_POWERED) !== 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getStateBitmask() : int{
|
public function getStateBitmask() : int{
|
||||||
return 0b1;
|
return 0b1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isPressed() : bool{ return $this->pressed; }
|
||||||
|
|
||||||
|
/** @return $this */
|
||||||
|
public function setPressed(bool $pressed) : self{
|
||||||
|
$this->pressed = $pressed;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user