Пример #1
0
  /**
   * Updates a villager entity with the zombie info this object is tracking.
   *
   * @param villager
   */
  public void updateVillager(EntityVillager villager) {

    // Note: I must trust that this object actually contain a zombie info. If not, the cast below
    // will fail.
    final ExtendedVillagerZombie properties = (ExtendedVillagerZombie) this.getObject();

    // Custom name
    if (this.getCustomName() != "") {
      villager.setCustomNameTag(this.getCustomName());
    }

    // Profession
    if (properties.getProfession() >= 0 && properties.getProfession() <= 4) { // vanilla professions
      villager.setProfession(properties.getProfession());
    }
  }