mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-31 23:33:06 +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(){
|
protected function checkPairing(){
|
||||||
if(($pair = $this->getPair()) instanceof Chest){
|
if(($pair = $this->getPair()) instanceof Chest){
|
||||||
|
if(!$pair->isPaired()){
|
||||||
|
$pair->createPair($this);
|
||||||
|
$pair->checkPairing();
|
||||||
|
}
|
||||||
if($this->doubleInventory === null){
|
if($this->doubleInventory === null){
|
||||||
if(($pair->x + ($pair->z << 15)) > ($this->x + ($this->z << 15))){ //Order them correctly
|
if(($pair->x + ($pair->z << 15)) > ($this->x + ($this->z << 15))){ //Order them correctly
|
||||||
$this->doubleInventory = new DoubleChestInventory($pair, $this);
|
$this->doubleInventory = new DoubleChestInventory($pair, $this);
|
||||||
@ -210,11 +214,7 @@ class Chest extends Spawnable implements InventoryHolder, Container{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->namedtag->pairx = new Int("pairx", $tile->x);
|
$this->createPair($tile);
|
||||||
$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();
|
$this->spawnToAll();
|
||||||
$tile->spawnToAll();
|
$tile->spawnToAll();
|
||||||
@ -223,6 +223,14 @@ class Chest extends Spawnable implements InventoryHolder, Container{
|
|||||||
return true;
|
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(){
|
public function unpair(){
|
||||||
if(!$this->isPaired()){
|
if(!$this->isPaired()){
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user