pocketmine\event\entity\ItemSpawnEvent::getEntity PHP Метод

getEntity() публичный Метод

public getEntity ( ) : Item
Результат pocketmine\entity\Item
    public function getEntity()
    {
        return $this->entity;
    }

Usage Example

Пример #1
0
 public function onDrops(ItemSpawnEvent $event)
 {
     $e = $event->getEntity();
     $vec = "{$e->x}:{$e->y}:{$e->z}";
     if (isset($this->itemQueue[$vec])) {
         unset($this->itemQueue[$vec]);
         $reflection_class = new \ReflectionClass($e);
         foreach ($reflection_class->getProperties() as $properties) {
             if ($properties->getName() == 'age') {
                 $property = $reflection_class->getProperty('age');
                 $property->setAccessible(true);
                 if ($property->getValue($event->getEntity()) == 0) {
                     $property->setValue($event->getEntity(), 7000);
                 }
             }
         }
     }
 }
All Usage Examples Of pocketmine\event\entity\ItemSpawnEvent::getEntity