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

Problem with addWindow()

Comments in 'Plugin Development' started by JackboyPlay, Jun 12, 2016.

  1. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Hello if I place a chest with a plugin and want to open the chest with the plugin [addWindow()] it doesnt works because I must have opened the chest 1 time before it works with addWindow
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Did you create the tile?
  3. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    @CraftYourBukkit
    PHP:
     $player->getLevel()->setBlockIdAt($player->getX(), $player->getY() - 2$player->getZ(), 54);//54 = Chest ID 
  4. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    A chest with an inventory is not a block, or does a grass block have an inventory? Nop, it doesn't. You need to create a chest tile. Click me.
    JackboyPlay likes this.
  5. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
  6. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
  7. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
  8. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    I'll get this error
    PHP:


    [13:52:04] [Server thread/CRITICAL]: TypeError"Argument 1 passed to pocketmine\tile\Chest::__construct() must implement interface pocketmine\level\format\FullChunk, none given, called in /root/benhosting/plugins/JCLobbySystem/src/JackboyPlay/JCLobbySystem/Main.php on line 136" (EXCEPTIONin "/src/pocketmine/tile/Chest" at line 45[13:52:04] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'JCLobbySystem v1.0.0': Argument 1 passed to pocketmine\tile\Chest::__construct() must implement interface pocketmine\level\format\FullChunk, none given, called in /root/benhosting/plugins/JCLobbySystem/src/JackboyPlay/JCLobbySystem/Main.php on line 136 on JackboyPlay\JCLobbySystem\Main 
  9. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    if the tile is going to be in the same chunk as the player you can use
    PHP:
    Tile::createTile("Chest"$player->chunk$nbt);
  10. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Get the same error here my code
    PHP:
    $block = new Chest();
    $player->getLevel()->setBlock(new Vector3($player->getFloorX(), $player->getFloorY() - 2$player->getFloorZ()), $blocktruetrue);
    $nbt = new CompoundTag("", [
    new 
    ListTag("Items", []),
    new 
    StringTag("id"Tile::CHEST),
    new 
    IntTag("x"$player->getFloorX()),
    new 
    IntTag("y"$player->getFloorY() - 2),
    new 
    IntTag("z"$player->getFloorZ())
    ]);
    $nbt->Items->setTagType(NBT::TAG_Compound);
    Tile::createTile("Chest"$player->chunk$nbt);
  11. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    Is the error on this line?
    PHP:
    $block = new Chest();
    Chest should be pocketmine\block\Chest and not pocketmine\tile\Chest
  12. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Yeah how to fix it?
  13. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    Change
    use pocketmine\tile\Chest
    to
    use pocketmine\block\Chest
  14. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    No doesnt work
  15. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    Ok then change
    PHP:
    $block = new Chest();
    to
    PHP:
    $block Block::get(Block::CHEST);
    and use pocketmine\block\Block;
  16. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    AndrewBit likes this.
  17. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    @wolfdale now it says
    PHP:


    [17:35:18] [Server thread/CRITICAL]: ClassNotFoundException"Class pocketmine\event\block not found" (EXCEPTIONin "/src/spl/BaseClassLoader" at line 144[Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'JCLobbySystem v1.0.0': Class pocketmine\event\block not found on JackboyPlay\JCLobbySystem\Main
    but I have implemented pocketmine\event\Block; already
  18. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    I don't understand. Why do you have to create a tile? You are only sending an inventory through the ContainerSetContentsPacket. Afaik, the client shouldn't care the tile associated.

    Perhaps you should delete all use statements and type them all over again :oops:
  19. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    0.14 cares if there is a tile though
  20. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    PHP:
    use pocketmine\block\Chest;
    *facepalm*

Share This Page

Advertisement