コード例 #1
0
ファイル: Tool.php プロジェクト: boybook/PocketMine-MP
 /**
  * TODO: Move this to each item
  *
  * @param Entity|Block $object
  *
  * @return bool
  */
 public function useOn($object)
 {
     if ($this->isHoe()) {
         if ($object instanceof Block and ($object->getID() === self::GRASS or $object->getID() === self::DIRT)) {
             $this->meta++;
         }
     } elseif ($object instanceof Entity and !$this->isSword()) {
         $this->meta += 2;
     } else {
         $this->meta++;
     }
     return true;
 }
コード例 #2
0
ファイル: Level.php プロジェクト: boybook/PocketMine-MP
 /**
  * @param Entity $entity
  *
  * @throws \RuntimeException
  */
 public function addEntity(Entity $entity)
 {
     if ($entity->getLevel() !== $this) {
         throw new \RuntimeException("Invalid Entity level");
     }
     if ($entity instanceof Player) {
         $this->players[$entity->getID()] = $entity;
     }
     $this->entities[$entity->getID()] = $entity;
 }
コード例 #3
0
ファイル: plugin.php プロジェクト: AmieXD/mts-plugin1
 public function isEntityExempted(Entity $entity)
 {
     return isset($this->exemptedEntities[$entity->getID()]);
 }