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

item slot

Comments in 'Plugin Development' started by TheMaks, Sep 30, 2015.

  1. TheMaks
    Offline

    TheMaks Active Member

    Joined:
    Jul 19, 2015
    Posts:
    58
    Minecraft User:
    TheMaks
    How to add the item to the player into the slot and not in inventory (AddItem ();)?
    Last edited: Sep 30, 2015
  2. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    You can't unless you can handle "fake" item packets successfully to perform all actions without having the player to carry the item in his inventory, otherwise is impossible to have an item without having it in the inventory
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Your question is unclear. What do you mean by "into the slot"?
  4. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    I think he/she wants to put an item into the hotbar and not the inventory. Kinda sounds almost impossible to me.
    CrazedMiner likes this.
  5. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    PocketMine doesn't yet have capability to set Hotbar slots, currently items randomly appear in the Hotbar.
  6. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    i think he means he get the item in inventory, AND becomes where he wants it in the hotbar
    TheKofola12 likes this.
  7. TheMaks
    Offline

    TheMaks Active Member

    Joined:
    Jul 19, 2015
    Posts:
    58
    Minecraft User:
    TheMaks
    What?
  8. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    oh nvm
    TheKofola12 likes this.
  9. TheMaks
    Offline

    TheMaks Active Member

    Joined:
    Jul 19, 2015
    Posts:
    58
    Minecraft User:
    TheMaks
    How se item in hotbar slot?
  10. TheMaks
    Offline

    TheMaks Active Member

    Joined:
    Jul 19, 2015
    Posts:
    58
    Minecraft User:
    TheMaks
    How set item in hotbar slot ?
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    If you have your item in the first slot in your inventory, and want to set the second hotbar slot to it:
    PHP:
    $inv->setHotbarSlotIndex(10);
  12. TheMaks
    Offline

    TheMaks Active Member

    Joined:
    Jul 19, 2015
    Posts:
    58
    Minecraft User:
    TheMaks
    PHP:
    $event->getPlayer()->getInventory()->setHotbarSlotIjdex(1,Item::get(41));
  13. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No. If you want to directly change its item, you have to use this:
    PHP:
    $event->getPlayer()->getInventory()->setItemInHand(Item::get(41));
    But this will replace the current holding item.

    Keep in mind that every MCPE hotbar slot points to a certain inventory slot.

Share This Page

Advertisement