接口 Villager

所有超级接口:
Ageable, Attributable, CommandSender, Creature, Damageable, Entity, InventoryHolder, LivingEntity, Merchant, Metadatable, Nameable, NPC, Permissible, ProjectileSource, ServerOperator

public interface Villager extends Ageable, NPC, InventoryHolder, Merchant
Represents a villager NPC
  • 方法详细资料

    • getProfession

      Villager.Profession getProfession()
      Gets the current profession of this villager.
      返回:
      Current profession.
    • setProfession

      void setProfession(Villager.Profession profession)
      Sets the new profession of this villager.
      参数:
      profession - New profession.
    • getCareer

      Villager.Career getCareer()
      Get the current Villager.Career for this Villager.
      返回:
      the Villager.Career
    • setCareer

      void setCareer(Villager.Career career)
      Set the new Villager.Career for this Villager. This method will reset the villager's trades to the new career.
      参数:
      career - the new career, or null to clear the career to a random one
      抛出:
      IllegalArgumentException - when the new Villager.Career cannot be used with this Villager's current Villager.Profession.
    • setCareer

      void setCareer(Villager.Career career, boolean resetTrades)
      Set the new Villager.Career for this Villager.
      参数:
      career - the new career, or null to clear the career to a random one
      resetTrades - true to reset this Villager's trades to the new career's (if any)
      抛出:
      IllegalArgumentException - when the new Villager.Career cannot be used with this Villager's current Villager.Profession.
    • getInventory

      Inventory getInventory()
      Gets this villager's inventory.
      Note that this inventory is not the Merchant inventory, rather, it is the items that a villager might have collected (from harvesting crops, etc.) 获取该对象的用户界面项目.

      原文:Get the object's inventory.

      指定者:
      getInventory 在接口中 InventoryHolder
      返回:
      The inventory.
    • getRiches

      int getRiches()
      Gets this villager's riches, the number of emeralds this villager has been given.
      返回:
      the villager's riches
    • setRiches

      void setRiches(int riches)
      Sets this villager's riches.
      参数:
      riches - the new riches
      另请参阅: