mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 16:24:05 +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{
|
||||
|
||||
/** @var bool */
|
||||
protected $powered = false;
|
||||
protected $pressed = false;
|
||||
|
||||
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{
|
||||
$this->powered = ($stateMeta & BlockLegacyMetadata::PRESSURE_PLATE_FLAG_POWERED) !== 0;
|
||||
$this->pressed = ($stateMeta & BlockLegacyMetadata::PRESSURE_PLATE_FLAG_POWERED) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
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