mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-19 15:35:52 +00:00
Added Chest recreation on imported levels
This commit is contained in:
parent
6dcb5da069
commit
d7be2ce439
@ -170,6 +170,10 @@ class Chest extends Spawnable implements InventoryHolder, Container{
|
||||
|
||||
protected function checkPairing(){
|
||||
if(($pair = $this->getPair()) instanceof Chest){
|
||||
if(!$pair->isPaired()){
|
||||
$pair->createPair($this);
|
||||
$pair->checkPairing();
|
||||
}
|
||||
if($this->doubleInventory === null){
|
||||
if(($pair->x + ($pair->z << 15)) > ($this->x + ($this->z << 15))){ //Order them correctly
|
||||
$this->doubleInventory = new DoubleChestInventory($pair, $this);
|
||||
@ -210,11 +214,7 @@ class Chest extends Spawnable implements InventoryHolder, Container{
|
||||
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->createPair($tile);
|
||||
|
||||
$this->spawnToAll();
|
||||
$tile->spawnToAll();
|
||||
@ -223,6 +223,14 @@ class Chest extends Spawnable implements InventoryHolder, Container{
|
||||
return true;
|
||||
}
|
||||
|
||||
private function createPair(Chest $tile){
|
||||
$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);
|
||||
}
|
||||
|
||||
public function unpair(){
|
||||
if(!$this->isPaired()){
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user