Fixed glowing item frames

due to technical limitations, this requires separating them back into two different block types. However, this isn't too egregious since it's just one flag, and actually simplifies some code.

closes #5478
This commit is contained in:
Dylan K. Taylor
2023-01-12 21:52:44 +00:00
parent 9c391a6809
commit ca1f1bf09f
12 changed files with 67 additions and 52 deletions

View File

@ -44,20 +44,12 @@ 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 describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{
$w->bool($this->glowing);
}
public function getRequiredStateDataBits() : int{ return 4; }
protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{
@ -141,14 +133,6 @@ 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, array &$returnedItems = []) : bool{
if($this->framedItem !== null){
$this->itemRotation = ($this->itemRotation + 1) % self::ROTATIONS;