接口 Villager

所有超级接口:
AbstractVillager, Ageable, Attributable, Breedable, CommandSender, Creature, Damageable, Entity, InventoryHolder, Leashable, LivingEntity, Lootable, Merchant, Metadatable, Mob, Nameable, NPC, Permissible, PersistentDataHolder, ProjectileSource, ServerOperator

public interface Villager extends AbstractVillager
表示村民NPC
  • 方法详细资料

    • getProfession

      获取此村民的当前职业。
      返回:
      当前职业。

      原文:Gets the current profession of this villager.

    • setProfession

      void setProfession(@NotNull @NotNull Villager.Profession profession)
      设置此村民的新职业。
      参数:
      profession - 新职业。

      原文:Sets the new profession of this villager.

      profession - New profession.
    • getVillagerType

      @NotNull @NotNull Villager.Type getVillagerType()
      获取此村民的当前类型。
      返回:
      当前类型。

      原文:Gets the current type of this villager.

    • setVillagerType

      void setVillagerType(@NotNull @NotNull Villager.Type type)
      设置此村民的新类型。
      参数:
      type - 新类型。

      原文:Sets the new type of this villager.

      type - New type.
    • getVillagerLevel

      int getVillagerLevel()
      获取此村民的等级。 等级为1且没有经验的村民可能会失去其职业。
      返回:
      此村民的等级

      原文:Gets the level of this villager. A villager with a level of 1 and no experience is liable to lose its profession.

    • setVillagerLevel

      void setVillagerLevel(int level)
      设置此村民的等级。 等级为1且没有经验的村民可能会失去其职业。
      参数:
      level - 新等级
      level - the new level
      抛出:
      IllegalArgumentException - 如果等级不在[1, 5]范围内

      原文:Sets the level of this villager. A villager with a level of 1 and no experience is liable to lose its profession.

      IllegalArgumentException - if level not between [1, 5]
    • getVillagerExperience

      int getVillagerExperience()
      获取此村民的交易经验。
      返回:
      交易经验

      原文:Gets the trading experience of this villager.

    • setVillagerExperience

      void setVillagerExperience(int experience)
      设置此村民的交易经验。
      参数:
      experience - 新经验
      experience - new experience
      抛出:
      IllegalArgumentException - 如果经验 < 0

      原文:Sets the trading experience of this villager.

      IllegalArgumentException - if experience < 0
    • sleep

      boolean sleep(@NotNull @NotNull Location location)
      尝试让此村民在给定位置睡觉。
      该位置必须在当前世界中,并且在该位置放置了床。村民在睡觉时会将头放在指定的方块上。
      参数:
      location - 床的位置
      location - the location of the bed
      返回:
      睡觉是否成功

      原文:Attempts to make this villager sleep at the given location.
      The location must be in the current world and have a bed placed at the location. The villager will put its head on the specified block while sleeping.

    • wakeup

      void wakeup()
      如果此村民正在睡觉,则唤醒他。
      抛出:
      IllegalStateException - 如果没有在睡觉

      原文:Causes this villager to wake up if he's currently sleeping.

      IllegalStateException - if not sleeping
    • shakeHead

      void shakeHead()
      让此村民摇头。

      原文:Causes this villager to shake his head.

    • zombify

      将此村民转换为僵尸村民,就像被僵尸杀死一样。 注意:这将触发EntityTransformEvent
      返回:
      转换后的实体ZombieVillager,如果转换被取消则返回null

      原文:Convert this Villager into a ZombieVillager as if it was killed by a Zombie. Note: this will fire a EntityTransformEvent

    • getReputation

      int getReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType)
      获取实体对给定类型的声誉。
      参数:
      uuid - 正在检查声誉的实体的UUID
      reputationType - 要获取的声誉类型
      uuid - the UUID of the entity whose reputation is being checked
      reputationType - reputation type to be retrieved
      返回:
      给定声誉类型的当前声誉

      原文:Gets the reputation of an entity for a given type.

    • getWeightedReputation

      int getWeightedReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType)
      获取实体对给定类型的加权声誉。

      实体的总声誉是其每种类型加权声誉的总和,其中声誉乘以分配给其类型的权重。

      参数:
      uuid - 正在检查声誉的实体的UUID
      reputationType - 要获取的声誉类型
      uuid - the UUID of the entity whose reputation is being checked
      reputationType - reputation type to be retrieved
      返回:
      给定声誉类型的当前声誉
      另请参阅:
    • getReputation

      int getReputation(@NotNull @NotNull UUID uuid)
      获取实体的声誉。
      参数:
      uuid - 正在检查声誉的实体的UUID
      uuid - the UUID of the entity whose reputation is being checked
      返回:
      给定声誉类型的当前声誉

      原文:Gets the reputation of an entity.

    • addReputation

      void addReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType, int amount)
      向给定实体添加给定类型的声誉。

      最终值将被限制在所提供声誉类型支持的最大值内。如果最终值低于声誉丢弃阈值,则与此声誉类型相关的八卦将被移除。

      注意:这将触发VillagerReputationChangeEvent。

      参数:
      uuid - 正在添加声誉的实体的UUID
      reputationType - 要修改的声誉类型
      amount - 要添加的声誉数量

      原文:Add reputation of a given type towards a given entity.

      The final value will be clamped to the maximum value supported by the provided reputation type. If the final value is below the reputation discard threshold, gossip associated with this reputation type will be removed.

      Note: this will fire a VillagerReputationChangeEvent.

      uuid - the UUID of the entity for whom the reputation is being added
      reputationType - reputation type to be modified
      amount - amount of reputation to add
    • addReputation

      void addReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType, int amount, @NotNull @NotNull Villager.ReputationEvent changeReason)
      向给定实体添加给定类型的声誉,并指定更改原因。

      最终值将被限制在所提供声誉类型支持的最大值内。如果最终值低于声誉丢弃阈值,则与此声誉类型相关的八卦将被移除。

      注意:这将触发VillagerReputationChangeEvent。

      参数:
      uuid - 正在添加声誉的实体的UUID
      reputationType - 要修改的声誉类型
      amount - 要添加的声誉数量
      changeReason - 声誉更改原因

      原文:Add reputation of a given type towards a given entity, with a specific change reason.

      The final value will be clamped to the maximum value supported by the provided reputation type. If the final value is below the reputation discard threshold, gossip associated with this reputation type will be removed.

      Note: this will fire a VillagerReputationChangeEvent.

      uuid - the UUID of the entity for whom the reputation is being added
      reputationType - reputation type to be modified
      amount - amount of reputation to add
      changeReason - reputation change reason
    • removeReputation

      void removeReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType, int amount)
      移除给定实体给定类型的声誉。

      最终值将被限制在所提供声誉类型支持的最大值内。如果最终值低于声誉丢弃阈值,则与此声誉类型相关的八卦将被移除。

      注意:这将触发VillagerReputationChangeEvent。

      参数:
      uuid - 正在移除声誉的实体的UUID
      reputationType - 要修改的声誉类型
      amount - 要移除的声誉数量

      原文:Remove reputation of a given type towards a given entity.

      The final value will be clamped to the maximum value supported by the provided reputation type. If the final value is below the reputation discard threshold, gossip associated with this reputation type will be removed.

      Note: this will fire a VillagerReputationChangeEvent.

      uuid - the UUID of the entity for whom the reputation is being removed
      reputationType - reputation type to be modified
      amount - amount of reputation to remove
    • removeReputation

      void removeReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType, int amount, @NotNull @NotNull Villager.ReputationEvent changeReason)
      移除给定实体给定类型的声誉,并指定更改原因。

      最终值将被限制在所提供声誉类型支持的最大值内。如果最终值低于声誉丢弃阈值,则与此声誉类型相关的八卦将被移除。

      注意:这将触发VillagerReputationChangeEvent。

      参数:
      uuid - 正在移除声誉的实体的UUID
      reputationType - 要修改的声誉类型
      amount - 要移除的声誉数量
      changeReason - 声誉更改原因

      原文:Remove reputation of a given type towards a given entity, with a specific change reason.

      The final value will be clamped to the maximum value supported by the provided reputation type. If the final value is below the reputation discard threshold, gossip associated with this reputation type will be removed.

      Note: this will fire a VillagerReputationChangeEvent.

      uuid - the UUID of the entity for whom the reputation is being removed
      reputationType - reputation type to be modified
      amount - amount of reputation to remove
      changeReason - reputation change reason
    • setReputation

      void setReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType, int amount)
      设置给定实体给定类型的声誉。

      最终值将被限制在所提供声誉类型支持的最大值内。如果最终值低于声誉丢弃阈值,则与此声誉类型相关的八卦将被移除。

      注意:这将触发VillagerReputationChangeEvent。

      参数:
      uuid - 正在添加声誉的实体的UUID
      reputationType - 要修改的声誉类型
      amount - 要添加的声誉数量

      原文:Set reputation of a given type towards a given entity.

      The final value will be clamped to the maximum value supported by the provided reputation type. If the final value is below the reputation discard threshold, gossip associated with this reputation type will be removed.

      Note: this will fire a VillagerReputationChangeEvent.

      uuid - the UUID of the entity for whom the reputation is being added
      reputationType - reputation type to be modified
      amount - amount of reputation to add
    • setReputation

      void setReputation(@NotNull @NotNull UUID uuid, @NotNull @NotNull Villager.ReputationType reputationType, int amount, @NotNull @NotNull Villager.ReputationEvent changeReason)
      设置给定实体给定类型的声誉,并指定更改原因。

      最终值将被限制在所提供声誉类型支持的最大值内。如果最终值低于声誉丢弃阈值,则与此声誉类型相关的八卦将被移除。

      注意:这将触发VillagerReputationChangeEvent。

      参数:
      uuid - 正在添加声誉的实体的UUID
      reputationType - 要修改的声誉类型
      amount - 要添加的声誉数量
      changeReason - 声誉更改原因

      原文:Set reputation of a given type towards a given entity, with a specific change reason.

      The final value will be clamped to the maximum value supported by the provided reputation type. If the final value is below the reputation discard threshold, gossip associated with this reputation type will be removed.

      Note: this will fire a VillagerReputationChangeEvent.

      uuid - the UUID of the entity for whom the reputation is being added
      reputationType - reputation type to be modified
      amount - amount of reputation to add
      changeReason - reputation change reason
    • setGossipDecayTime

      void setGossipDecayTime(long ticks)
      设置此村民的声誉衰减时间。

      默认为24000(1个昼夜周期)。

      参数:
      ticks - 村民声誉衰减的刻数

      原文:Sets the reputation decay time for this villager.

      Defaults to 24000 (1 daylight cycle).

      ticks - amount of ticks until the villager's reputation decays
    • getGossipDecayTime

      long getGossipDecayTime()
      获取此村民的声誉衰减时间。

      默认为24000(1个昼夜周期)。

      返回:
      村民声誉衰减的刻数

      原文:Gets the reputation decay time for this villager.

      Defaults to 24000 (1 daylight cycle).