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

addWindow() chest not seems to open

Comments in 'Plugin Development' started by AvivShopenCraft, Jun 21, 2016.

  1. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
    Hi, i have a problem, im trying to do that every time player type /echest itll spawn a chest 2 block underneath him and itll set the saved contents, and when he closes the inventory, the chest will be set the the original block, anyways i just finished and i typed /echest, the chest spawned i even created a tile for it, but its not opening, any idea why?
  2. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen
  3. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Users Who Have Read This Thread (Total: 4)
    One of them was you, one was me. Do you expect that everyone here knows the answer? Those people might have just looked here because they need an answer as well. Please just wait for someone to get online and reply.

    Can you please show us your code? We cannot know what's wrong without even knowing what you did.
  4. Jazzwhistle
    Offline

    Jazzwhistle Notable Member

    Joined:
    Dec 27, 2014
    Posts:
    364
    Minecraft User:
    Awzaw
    Have you checked with other PM forks? Just for testing?! I had the same problem with doors recently - it was simply that the client wasn't updating my view on official PM, so even though my doors were actually opening, I couldn't see them opening...
  5. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    I saw this at using bone meal on trees
  6. AvivShopenCraft
    Offline

    AvivShopenCraft New Member

    Joined:
    Oct 14, 2015
    Posts:
    73
    Minecraft User:
    AvivShopen

    Im sorry, i will notice it next time :)
    and about the code:

    PHP:
    $this->id[$pl->getName()] = $pl->getLevel()->getBlockIdAt($pl->x$pl->2$pl->z);
                        
    $pl->getLevel()->setBlock(new Vector3($pl->x$pl->2$pl->z), Block::get(Block::CHEST));
                        
    $nbt = new CompoundTag("", [
                        new 
    ListTag("Items", []),
                        new 
    StringTag("id"Tile::CHEST),
                        new 
    IntTag("x"$pl->x),
                        new 
    IntTag("y"$pl->2),
                        new 
    IntTag("z"$pl->z)
                        ]);
                        
    $nbt->Items->setTagType(NBT::TAG_Compound);
                        
    $tile Tile::createTile("Chest"$pl->getLevel()->getChunk($pl->>> 4$pl->>> 4), $nbt);
                        
    $chest $pl->getLevel()->getTile(new Vector3($pl->x$pl->2$pl->z));
                        
    $this->task[$pl->getName()] = 2;
                        
    $pl->addWindow($chest->getInventory());
                        
    $chest->getInventory()->setContents($this->getEchestInventory($pl));
    EDIT: Changed code type to PHP

Share This Page

Advertisement