From 017ca55a58be689ba4e12dcc13f53f02f5efd5bf Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 27 Apr 2021 15:19:55 +0100 Subject: [PATCH] Vine: use facing as both keys and values --- src/block/Vine.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/block/Vine.php b/src/block/Vine.php index ac76a81b5..a247b06e3 100644 --- a/src/block/Vine.php +++ b/src/block/Vine.php @@ -35,7 +35,7 @@ use function count; class Vine extends Flowable{ - /** @var bool[] */ + /** @var int[] */ protected $faces = []; public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ @@ -63,7 +63,7 @@ class Vine extends Flowable{ private function setFaceFromMeta(int $meta, int $flag, int $face) : void{ if(($meta & $flag) !== 0){ - $this->faces[$face] = true; + $this->faces[$face] = $face; }else{ unset($this->faces[$face]); } @@ -96,7 +96,7 @@ class Vine extends Flowable{ } $this->faces = $blockReplace instanceof Vine ? $blockReplace->faces : []; - $this->faces[Facing::opposite($face)] = true; + $this->faces[Facing::opposite($face)] = Facing::opposite($face); return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player); } @@ -108,7 +108,7 @@ class Vine extends Flowable{ //check which faces have corresponding vines in the block above $supportedFaces = $up instanceof Vine ? array_intersect_key($this->faces, $up->faces) : []; - foreach($this->faces as $face => $bool){ + foreach($this->faces as $face){ if(!isset($supportedFaces[$face]) and !$this->getSide($face)->isSolid()){ unset($this->faces[$face]); $changed = true;