Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Pairing chests

Comments in 'Plugin Development' started by Irish, May 19, 2016.

  1. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    I have tried to pair two chests into one double chest, with no luck. It sets the chests, but does not pair them.
    PHP:
    $entity $event->getEntity();
            
    $lvl $entity->getLevel();
            if (
    $entity instanceof Player) {
                
    $x $entity->getX();
                
    $y $entity->getY();
                
    $z $entity->getZ();

                
    $inventory $entity->getInventory()->getContents();
                
    $event->setDrops(array(Item::get(Item::AIR)));
                
    $entity->getLevel()->setBlock(new Vector3($x$y$z), new Block(Block::CHEST), truetrue);
                
    $entity->getLevel()->setBlock(new Vector3($x-1$y$z), new Block(Block::CHEST), truetrue);
                
    $nbt = new CompoundTag("", [new ListTag("Items", []), new StringTag("id"Tile::CHEST), new IntTag("x"$x), new IntTag("y"$y), new IntTag("z"$z)]);
                
    $nbt->Items->setTagType(NBT::TAG_Compound);
                
    $tile Tile::createTile("Chest"$entity->getLevel()->getChunk($x >> 4$z >> 4), $nbt);
                
    $ochest $lvl->getTile(new Vector3($x-1$y$z));
                
    $chest $lvl->getTile(new Vector3($x$y$z));
                if(
    $chest instanceof Chest){
                    if(
    $chest->isPaired() === false){
                        if(
    $ochest instanceof Chest){
                        
    $chest->pairWith($ochest);
                        
    $chest->getInventory()->setContents($inventory);
                    }

                }
            }
        }
  2. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    Bump ^^
  3. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    No one at all?

Share This Page

Advertisement