mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-24 04:14:07 +00:00
ItemFrame: added ROTATIONS constant
This commit is contained in:
parent
998dcb421e
commit
ff35736bf9
@ -32,6 +32,7 @@ use pocketmine\tile\ItemFrame as TileItemFrame;
|
|||||||
use function lcg_value;
|
use function lcg_value;
|
||||||
|
|
||||||
class ItemFrame extends Flowable{
|
class ItemFrame extends Flowable{
|
||||||
|
public const ROTATIONS = 8;
|
||||||
|
|
||||||
/** @var int */
|
/** @var int */
|
||||||
protected $facing = Facing::NORTH;
|
protected $facing = Facing::NORTH;
|
||||||
@ -61,7 +62,7 @@ class ItemFrame extends Flowable{
|
|||||||
if($this->framedItem->isNull()){
|
if($this->framedItem->isNull()){
|
||||||
$this->framedItem = null;
|
$this->framedItem = null;
|
||||||
}
|
}
|
||||||
$this->itemRotation = $tile->getItemRotation() % 8;
|
$this->itemRotation = $tile->getItemRotation() % self::ROTATIONS;
|
||||||
$this->itemDropChance = $tile->getItemDropChance();
|
$this->itemDropChance = $tile->getItemDropChance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,8 +144,7 @@ class ItemFrame extends Flowable{
|
|||||||
|
|
||||||
public function onActivate(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
public function onActivate(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||||
if($this->framedItem !== null){
|
if($this->framedItem !== null){
|
||||||
$this->itemRotation = ($this->itemRotation + 1) % 8;
|
$this->itemRotation = ($this->itemRotation + 1) % self::ROTATIONS;
|
||||||
$this->itemRotation %= 8;
|
|
||||||
}elseif(!$item->isNull()){
|
}elseif(!$item->isNull()){
|
||||||
$this->framedItem = $item->pop();
|
$this->framedItem = $item->pop();
|
||||||
}else{
|
}else{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user