/** * 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; }
/** * @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; }
public function isEntityExempted(Entity $entity) { return isset($this->exemptedEntities[$entity->getID()]); }