@Deprecated public DesireMoveAndMeleeAttack( RemoteEntity inEntity, Class<?> inToAttack, boolean inIgnoreSight) { this(inEntity, inToAttack, inIgnoreSight, inEntity.getSpeed()); }
/** * Creates the entity with the earlier specified parameters * * @return Created entity * @throws NoTypeException When no type is specified * @throws NoNameException When no name is specified while trying to spawn a named entity */ public RemoteEntity create() { RemoteEntity created; if (this.m_type == null) throw new NoTypeException(); this.m_id = this.m_manager.getNextFreeID(this.m_id); if (this.m_type.isNamed()) { if (this.m_name == null) throw new NoNameException("Tried to spawn a named entity without name"); created = this.m_manager.createNamedEntity(this.m_type, this.m_id, this.m_name); } else created = this.m_manager.createEntity(this.m_type, this.m_id); for (Feature feature : this.m_features) { created.getFeatures().addFeature(feature); } for (Behavior behavior : this.m_behaviors) { created.getMind().addBehaviour(behavior); } for (DesireItem desire : this.m_movementDesires) { created.getMind().addMovementDesire(desire.getDesire(), desire.getPriority()); } for (DesireItem desire : this.m_actionDesires) { created.getMind().addTargetingDesire(desire.getDesire(), desire.getPriority()); } created.setStationary(this.m_stationary); created.setPushable(this.m_pushable); if (this.m_speed != -1) created.setSpeed(this.m_speed); if (this.m_location != null) created.spawn(this.m_location); if (this.m_maxHealth != -1 && created.getBukkitEntity() != null) created.getBukkitEntity().setMaxHealth(this.m_maxHealth); if (this.m_pathfindingRange != -1) created.setPathfindingRange(this.m_pathfindingRange); return created; }