public function pairWith(Chest $tile) { if ($this->isPaired() or $tile->isPaired()) { return false; } $this->namedtag->pairx = new Int("pairx", $tile->x); $this->namedtag->pairz = new Int("pairz", $tile->z); $tile->namedtag->pairx = new Int("pairx", $this->x); $tile->namedtag->pairz = new Int("pairz", $this->z); $this->spawnToAll(); $tile->spawnToAll(); $this->checkPairing(); return true; }
public function pairWith(Chest $tile) { if ($this->isPaired() or $tile->isPaired()) { return false; } $this->createPair($tile); $this->spawnToAll(); $tile->spawnToAll(); $this->checkPairing(); return true; }
public function refillChest(Chest $chest, $refillPair = true) { $replaceSlots = []; $chest->clearAll(); if (count($replaceSlots) >= $chest->getSize() / 2) { array_slice($replaceSlots, $chest->getSize() / 2 - 1); } foreach ($replaceSlots as $slot) { $item = null; // TODO: Decide items to put in chest. $chest->setItem($slot, $item); } if ($chest->isPaired() && $refillPair) { // Large chests $this->refillChest($chest->getPair(), false); } }