protected function checkPairing()
{
if (($pair = $this->getPair()) instanceof Chest) {
if (!$pair->isPaired()) {
$pair->createPair($this);
$pair->checkPairing();
}
if ($this->doubleInventory === null) {
if (($p = $pair->getDoubleInventory()) instanceof DoubleChestInventory) {
$this->doubleInventory = $p;
} else {
if ($pair->x + ($pair->z << 15) > $this->x + ($this->z << 15)) {
//Order them correctly
$this->doubleInventory = new DoubleChestInventory($pair, $this);
} else {
$this->doubleInventory = new DoubleChestInventory($this, $pair);
}
}
}
} else {
$this->doubleInventory = null;
unset($this->namedtag->pairx, $this->namedtag->pairz);
}
}