1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Use Lore

Discussion in 'Development' started by kiencool, Sep 2, 2017.

  1. kiencool

    kiencool Spider Jockey

    Messages:
    36
    How to add lore to item plz help me
     
  2. KYUMA

    KYUMA Silverfish

    Messages:
    16
    GitHub:
    Ky75
    ?
     
    Karanpatel567 likes this.
  3. sharletsings123

    sharletsings123 Baby Zombie

    Messages:
    116
    GitHub:
    sharletk
    What do you mean by lore?
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Last edited: Sep 3, 2017
  5. sharletsings123

    sharletsings123 Baby Zombie

    Messages:
    116
    GitHub:
    sharletk
    Argh that. I didn't know what he meant by lore first.
     
  6. Az928

    Az928 Baby Zombie

    Messages:
    140
    GitHub:
    theaz928
    $item->setLore(array("line1", "line2"));

    Don't forget to update the item by setting the item in hand ;)
     
    Taco and NickTehUnicorn like this.
  7. Indexfire

    Indexfire Baby Zombie

    Messages:
    137
    GitHub:
    Indexfire
    Ack its been 5 months since i touched PHP so i may be wrong or this may be outdated... (or since im guessing the method names cause im a lazy fuck the method names may be wrong)
    PHP:
    public function chat(PlayerChatEvent $event){
         
    $player $event->getPlayer();
         
    $lore = array(TextFormat::RED "Ability: Arcane Beam"TextFormat::GREEN "Deals 5 Damage");
         
    $item = new ItemStack(Material::DIAMOND_SWORD);
         
    $meta $item->getItemMeta();
         
    $meta->setLore($lore);
         
    $item->setItemMeta($meta);
         
    $player->setItemInHand($item);
         
    $player->updateInventory();
    }
     
  8. Az928

    Az928 Baby Zombie

    Messages:
    140
    GitHub:
    theaz928
    ItenStack isn't a class right now...
    $item = Item::get($id, $meta, $count);
    $item->setLore($lore);
    $player->getInventory()->setItemInHand($item);
     
  9. ZackyVN

    ZackyVN Baby Zombie

    Messages:
    150
    I think he mean is
    Some message down the item name
     
  10. Indexfire

    Indexfire Baby Zombie

    Messages:
    137
    GitHub:
    Indexfire
    Well i did say i was lazy to find the right methods and this was just a rough example :p

    EDIT: Also im giving him an idea of how to do it and not directly spoon feeding him xd
     
    Last edited: Sep 12, 2017
    jasonwynn10 likes this.
  11. Taco

    Taco Spider Jockey

    Messages:
    41
    GitHub:
    taconoburrito
  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.