Solved what are item call things?

Discussion in 'Development' started by iBa4x, Mar 25, 2020.

  1. iBa4x

    iBa4x Silverfish

    Messages:
    24
    GitHub:
    iBa4x
    I want to know how I delete all inventory item and how to add items in slot or in inventory
    I want to know if I can add potion item because I researched in https://github.com/pmmp/PocketMine-MP/tree/stable/src/pocketmine/item and I see many things about item complicated for me
    even about enchants things.

    someone help me how to call these things.
     
  2. wolfdale

    wolfdale Zombie

    Messages:
    396
  3. iBa4x

    iBa4x Silverfish

    Messages:
    24
    GitHub:
    iBa4x
    Thank for that!!

    I understand now how to clear item by " getInventory()->clearAll(); " and how to add or set item by " getInventory()->addItem(Item::get(1,0,1)); " and " getInventory()->setItem(0 ,Item::get(1,0,1)); " I also understand how to enchant by makeing item variable " $item = Item::get(1,0,1); " then give it the enchant like that " $item->addEnchantment(new EnchantmentInstance(Enchantment::getEnchantment($enchantnumber), 1)); " than addItem($item) with the same variable!
    what I really don't understand it is how to get potion :(.

    - I hope someone explain it for me after I do search I think I can't get it by coding but it's there in PocketMine and in the Server.
     
  4. wolfdale

    wolfdale Zombie

    Messages:
    396
    Example
    PHP:
    $item = new \pocketmine\item\Potion(\pocketmine\item\Potion::INVISIBILITY);
     
    Khaled, iBa4x and HimbeersaftLP like this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.