mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
Added glowing item frames
This commit is contained in:
@ -41,12 +41,24 @@ class ItemFrame extends Flowable{
|
||||
|
||||
public const ROTATIONS = 8;
|
||||
|
||||
protected bool $glowing = false;
|
||||
|
||||
protected bool $hasMap = false; //makes frame appear large if set
|
||||
|
||||
protected ?Item $framedItem = null;
|
||||
protected int $itemRotation = 0;
|
||||
protected float $itemDropChance = 1.0;
|
||||
|
||||
public function getRequiredTypeDataBits() : int{ return 1; }
|
||||
|
||||
protected function decodeType(RuntimeDataReader $r) : void{
|
||||
$this->glowing = $r->readBool();
|
||||
}
|
||||
|
||||
protected function encodeType(RuntimeDataWriter $w) : void{
|
||||
$w->writeBool($this->glowing);
|
||||
}
|
||||
|
||||
public function getRequiredStateDataBits() : int{ return 4; }
|
||||
|
||||
protected function decodeState(RuntimeDataReader $r) : void{
|
||||
@ -133,6 +145,14 @@ class ItemFrame extends Flowable{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isGlowing() : bool{ return $this->glowing; }
|
||||
|
||||
/** @return $this */
|
||||
public function setGlowing(bool $glowing) : self{
|
||||
$this->glowing = $glowing;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||
if($this->framedItem !== null){
|
||||
$this->itemRotation = ($this->itemRotation + 1) % self::ROTATIONS;
|
||||
|
Reference in New Issue
Block a user