GetItem

Discussion in 'Development' started by yBriisMC, May 2, 2022.

  1. yBriisMC

    yBriisMC Spider Jockey

    Messages:
    34
    look at me here again lol
    Well I used this code in PM3 $item1 = Item::get(10, 0, 1);
    With a custom name and everything I used this same code in the public getItems function but it gave me an error in Item::get I was told that I change the give item can someone explain to me

    (I RESEARCHED BUT DIDN'T FIND ANYTHING ABOUT IT)
     
  2. yBriisMC

    yBriisMC Spider Jockey

    Messages:
    34
    I use Pocketmine 4.0.0 and I don't know if I change the method of doing it
     
  3. FresherGAMING

    FresherGAMING Spider Jockey

    Messages:
    43
    GitHub:
    FresherGAMING
    Use ItemFactory instead
    example :
    PHP:
    use pocketmine\item\ItemFactory;

    //get item
    $diamond ItemFactory::getInstance()->get($id$meta$amount);

    //if you want to change the name just do like the old one
    $diamond->setCustomName($customname);
     
  4. yBriisMC

    yBriisMC Spider Jockey

    Messages:
    34
    Do I make the normal public or do I put something else?
     
  5. FresherGAMING

    FresherGAMING Spider Jockey

    Messages:
    43
    GitHub:
    FresherGAMING
    You don't need to make the normal public, just put it like the old one
     

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.