34 use AnimatedBlockInventoryTrait;
36 public function __construct(
40 $this->holder = $this->left->getHolder();
41 parent::__construct();
44 public function getInventory() :
self{
53 return $index < $this->left->getSize() ? $this->left->getItem($index) : $this->right->getItem($index - $this->left->getSize());
56 protected function internalSetItem(
int $index,
Item $item) : void{
57 $index < $this->left->getSize() ? $this->left->setItem($index, $item) : $this->right->setItem($index - $this->left->getSize(), $item);
60 public function getContents(
bool $includeEmpty =
false) : array{
61 $result = $this->left->getContents($includeEmpty);
62 $leftSize = $this->left->getSize();
64 foreach($this->right->getContents($includeEmpty) as $i => $item){
65 $result[$i + $leftSize] = $item;
72 $leftSize = $this->left->getSize();
77 foreach($items as $i => $item){
78 if($i < $this->left->getSize()){
79 $leftContents[$i] = $item;
81 $rightContents[$i - $leftSize] = $item;
84 $this->left->setContents($leftContents);
85 $this->right->setContents($rightContents);
89 $leftSize = $this->left->getSize();
90 return $slot < $leftSize ?
91 $this->left->getMatchingItemCount($slot, $test, $checkTags) :
92 $this->right->getMatchingItemCount($slot - $leftSize, $test, $checkTags);
96 $leftSize = $this->left->getSize();
97 return $index < $leftSize ?
98 $this->left->isSlotEmpty($index) :
99 $this->right->isSlotEmpty($index - $leftSize);
104 protected function getCloseSound() :
Sound{ return new ChestCloseSound(); }
106 protected function animateBlock(
bool $isOpen) : void{
107 $this->left->animateBlock($isOpen);
108 $this->right->animateBlock($isOpen);
111 public function getLeftSide() : ChestInventory{
115 public function getRightSide() : ChestInventory{