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

Solved Add enchantement on Item

Discussion in 'Development' started by Notjblus, Jun 22, 2019.

  1. Notjblus

    Notjblus Spider Jockey

    Messages:
    28
    GitHub:
    JblusItsMe
    PHP:
    $p->getInventory()->addItem(Item::Get(26101)->setCustomName("Laser Evolution"));
    on a line like this, how could I add to this item an Innifity level 2 enchantment

    Here is the complete code if there is something to change (I modify the send message express to show)

    PHP:
    if ($b->getID() === BlockIds::SIGN_POST || $b->getId() === BlockIds::WALL_SIGN) {
                if(
    $tile instanceof Sign) {
                    if (
    $tile->getText()[0] === "§7-§6LgKit§7-" && $tile->getText()[2] === "Simple Kit" && $tile->getText()[3] === "§bClic to start") {
                        
    $p->sendMessage("\n\nClic on sign");
                        
    $p->teleport(new Position (226,57,297,$this->getServer()->getLevelByName("world")));
                        
    $p->setHealth($p->getMaxHealth());
                        
    $p->setFood(20);
                        
    $p->sendTip("§fKit Selected: §eSimpleKit");
                        
    $p->getInventory()->clearAll();
                        
    $p->getInventory()->addItem(Item::Get(26101)->setCustomName("Item name"));
                        
    $p->getInventory()->addItem(Item::Get(28701)->setCustomName("SafeLife"));
                    }
                }
            }
     
    Last edited: Jun 22, 2019
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
  3. Mr174

    Mr174 Baby Zombie

    Messages:
    187
    GitHub:
    mr174
    I wanna recode this but then.... I don't wanna lol
     
  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.