pocketmine\event\entity\EntityInventoryChangeEvent::getNewItem PHP Method

getNewItem() public method

public getNewItem ( )
    public function getNewItem()
    {
        return $this->newItem;
    }

Usage Example

Esempio n. 1
0
 public function clear($index)
 {
     if (isset($this->slots[$index])) {
         $item = Item::get(Item::AIR, \null, 0);
         $old = $this->slots[$index];
         $holder = $this->getHolder();
         if ($holder instanceof Entity) {
             Server::getInstance()->getPluginManager()->callEvent($ev = new EntityInventoryChangeEvent($holder, $old, $item, $index));
             if ($ev->isCancelled()) {
                 $this->sendSlot($index, $this->getViewers());
                 return \false;
             }
             $item = $ev->getNewItem();
         }
         if ($item->getId() !== Item::AIR) {
             $this->slots[$index] = clone $item;
         } else {
             unset($this->slots[$index]);
         }
         $this->onSlotChange($index, $old);
     }
     return \true;
 }
All Usage Examples Of pocketmine\event\entity\EntityInventoryChangeEvent::getNewItem