接口 HumanEntity

所有超级接口:
AnimalTamer, Attributable, CommandSender, Damageable, Entity, InventoryHolder, Leashable, LivingEntity, Metadatable, Nameable, Permissible, PersistentDataHolder, ProjectileSource, ServerOperator
所有已知子接口:
Player

public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
代表人类实体, 比如一个NPC或一名玩家
  • 方法详细资料

    • getName

      返回该玩家的玩家名.

      原文:Returns the name of this player

      指定者:
      getName 在接口中 AnimalTamer
      指定者:
      getName 在接口中 CommandSender
      返回:
      玩家名
    • getInventory

      获取玩家的物品栏(俗称背包).

      原文:Get the player's inventory.

      指定者:
      getInventory 在接口中 InventoryHolder
      返回:
      玩家物品栏, 包含盔甲槽
    • getEnderChest

      @NotNull @NotNull Inventory getEnderChest()
      获取玩家的末影箱物品栏.

      原文:Get the player's EnderChest inventory

      返回:
      玩家的末影箱
    • getMainHand

      @NotNull @NotNull MainHand getMainHand()
      获取玩家设置的主手.

      原文:Gets the player's selected main hand

      返回:
      玩家主手
    • isModelPartShown

      boolean isModelPartShown(@NotNull @NotNull PlayerModelPart part)
      获取玩家模型的某一部分是否显示。

      原文:Gets whether a part of the player model is shown.

      参数:
      part - 模型部件
      返回:
      该部件是否显示
    • setWindowProperty

      @Deprecated(forRemoval=true, since="1.21") boolean setWindowProperty(@NotNull InventoryView.Property prop, int value)
      已过时, 待删除: 此 API 元素将从以后的版本中删除。
      请使用 InventoryView 及其子类
      若玩家当前打开了一个物品栏窗口, 此方法将设置窗口的属性, 比如酿造台的酿造进度.

      原文:If the player currently has an inventory window open, this method will set a property of that window, such as the state of a progress bar.

      参数:
      prop - 窗口属性
      value - 要设置的属性值
      返回:
      若属性成功设置返回true
    • getEnchantmentSeed

      int getEnchantmentSeed()
      获取玩家当前的附魔种子。

      原文:Gets the player's current enchantment seed. 该种子用于在附魔台中为玩家生成附魔选项。

      返回:
      玩家的附魔种子
    • setEnchantmentSeed

      void setEnchantmentSeed(int seed)
      设置玩家的附魔种子。

      原文:Sets the player's enchantment seed. 该种子用于在附魔台中为玩家生成附魔选项。

      参数:
      seed - 玩家的新附魔种子
    • getOpenInventory

      @NotNull @NotNull InventoryView getOpenInventory()
      获取玩家正在查看的物品栏. 如果他们没有打开任何物品栏窗口, 将返回他们的内部合成视图(玩家背包的那四个格子?).

      原文:Gets the inventory view the player is currently viewing. If they do not have an inventory window open, it returns their internal crafting view.

      返回:
      物品栏视图
    • openInventory

      打开一个物品栏, 窗口顶部为你指定的物品栏, 底部为玩家物品栏(背包).

      原文:Opens an inventory window with the specified inventory on the top and the player's inventory on the bottom.

      参数:
      inventory - 要打开的物品栏
      返回:
      新打开的物品栏的视图
    • openWorkbench

      @Deprecated(since="1.21.4") @Nullable @Nullable InventoryView openWorkbench(@Nullable @Nullable Location location, boolean force)
      已过时。
      此方法应由 MenuType.CRAFTING 代替, 参见 MenuType.Typed.builder() 及其选项.
      打开一个空白工作台物品栏界面, 玩家物品栏(背包)在底部.

      原文:Opens an empty workbench inventory window with the player's inventory on the bottom.

      参数:
      location - 工作台位置. 若为null, 将使用玩家所处位置
      force - 若为false, 同时指定位置不是工作台方块, 将不会打开工作台物品栏, 并返回null(true就是不管怎样都向 玩家展示工作台界面)
      返回:
      新打开的物品栏的视图, 如果不能打开返回null
    • openEnchanting

      @Deprecated(since="1.21.4") @Nullable @Nullable InventoryView openEnchanting(@Nullable @Nullable Location location, boolean force)
      已过时。
      T此方法应由 MenuType.ENCHANTMENT 代替, 参见 MenuType.Typed.builder() 及其选项.
      打开一个空白附魔台物品栏界面, 玩家物品栏(背包)在底部.

      原文:Opens an empty enchanting inventory window with the player's inventory on the bottom.

      参数:
      location - 附魔台位置. 若为null, 将使用玩家所处位置
      force - 若为false, 同时指定位置不是附魔台方块, 将不会打开工作台物品栏, 并返回null(true就是不管怎样都向 玩家展示附魔台界面)
      返回:
      新打开的物品栏的视图, 如果不能打开返回null
    • openInventory

      void openInventory(@NotNull @NotNull InventoryView inventory)
      打开指定的物品栏.

      InventoryView 关联的玩家必须与此 HumanEntity 实例相同.

      InventoryView 关联的玩家可通过 InventoryView.getPlayer() 获取.

      原文:Opens an inventory window to the specified inventory view.

      The player associated with the InventoryView must be the same as this instance of HumanEntity.

      The player of the InventoryView can be checked using InventoryView.getPlayer().

      参数:
      inventory - 要打开的物品栏视图
    • openMerchant

      @Deprecated(since="1.21.4") @Nullable @Nullable InventoryView openMerchant(@NotNull @NotNull Villager trader, boolean force)
      已过时。
      此方法可由 MenuType.MERCHANT 代替, 并使用 openInventory(InventoryView)
      与某村民开始交易. 注意: 同一时间内只有一名玩家可以与此村民进行交易. 欲使多名玩家能同时与此村民进行交易, 请将“force”参数设为true.

      原文:Starts a trade between the player and the villager. Note that only one player may trade with a villager at once. You must use the force parameter for this.

      参数:
      trader - 与哪位村民交易. 不能为null
      force - 是否强制开始交易, 即使另一名玩家正在与此村民交易
      返回:
      新打开的物品栏的视图, 如果不能打开返回null
    • openMerchant

      @Deprecated(since="1.21.4") @Nullable @Nullable InventoryView openMerchant(@NotNull @NotNull Merchant merchant, boolean force)
      已过时。
      此方法可由 MenuType.MERCHANT 代替, 并使用 openInventory(InventoryView)
      与某商人开始交易. 注意: 同一时间内只有一名玩家可以与此商人进行交易. 欲使多名玩家能同时与此商人进行交易, 请将“force”参数设为true.

      原文:Starts a trade between the player and the merchant. Note that only one player may trade with a merchant at once. You must use the force parameter for this.

      参数:
      merchant - 与哪个商人交易. 不能为null
      force - 是否强制开始交易, 即使另一名玩家正在与此商人交易
      返回:
      新打开的物品栏的视图, 如果不能打开返回null
    • closeInventory

      void closeInventory()
      强制关闭玩家当前打开的物品栏视图.

      原文:Force-closes the currently open inventory view for this player, if any.

    • getItemInHand

      @Deprecated(since="1.9") @NotNull @NotNull ItemStack getItemInHand()
      已过时。
      人类现能双持, 请使用 PlayerInventory 中更明确的方法
      返回你手握的物品, 可能为空.

      原文:Returns the ItemStack currently in your hand, can be empty.

      返回:
      你正在握持的物品的ItemStack(物品堆)对象
    • setItemInHand

      @Deprecated(since="1.9") void setItemInHand(@Nullable @Nullable ItemStack item)
      已过时。
      人类现能双持, 请使用 PlayerInventory 中更明确的方法
      设置你手握的物品, 将替换你所持的任何物品.

      原文:Sets the item to the given ItemStack, this will replace whatever the user was holding.

      参数:
      item - 要设置的物品堆
    • getItemOnCursor

      @NotNull @NotNull ItemStack getItemOnCursor()
      返回你的鼠标正在拖动的物品, 可能为空. 如果玩家没有打开任何窗口, 将永远为空(AIR).

      译注:这个方法是适用于物品拖动场景的, 只有鼠标指针在物品上而没有拖动它是获取不到的(AIR).

      原文:Returns the ItemStack currently on your cursor, can be empty. Will always be empty if the player currently has no open window.

      返回:
      你正在拖动的物品的ItemStack对象
    • setItemOnCursor

      void setItemOnCursor(@Nullable @Nullable ItemStack item)
      设置你正在拖动的物品, 将替换你所拖动的任何物品. 如果玩家没有打开任何窗口, 将永远为空(AIR).

      原文:Sets the item to the given ItemStack, this will replace whatever the user was moving. Will always be empty if the player currently has no open window.

      参数:
      item - 要设置的物品堆
    • hasCooldown

      boolean hasCooldown(@NotNull @NotNull Material material)
      检查指定物品是否处于冷却状态.

      原文:Check whether a cooldown is active on the specified material.

      参数:
      material - 要检查的物品种类
      返回:
      该物品是否进入了冷却
      抛出:
      IllegalArgumentException - 如果 material 不是物品
    • getCooldown

      int getCooldown(@NotNull @NotNull Material material)
      获取指定物品的冷却时长 (以tick为单位).

      原文:Get the cooldown time in ticks remaining for the specified material.

      参数:
      material - 要检查的物品种类
      返回:
      剩余冷却时长 (以tick为单位)
      抛出:
      IllegalArgumentException - 如果 material 不是物品
    • setCooldown

      void setCooldown(@NotNull @NotNull Material material, int ticks)
      设置指定物品的冷却时长. 设为0 tick将导致移除此物品的冷却.

      冷却被服务器用来针对某些物品比如末影珍珠、盾牌等以防止它们被经常重复使用.

      请注意: 冷却时间自身不会阻止某个物品被用来使用或攻击.

      原文:Set a cooldown on the specified material for a certain amount of ticks. ticks. 0 ticks will result in the removal of the cooldown.

      Cooldowns are used by the server for items such as ender pearls and shields to prevent them from being used repeatedly.

      Note that cooldowns will not by themselves stop an item from being used for attacking.

      参数:
      material - 为哪个物品设置冷却
      ticks - 冷却时长(以tick为单位)或设为0来移除它
      抛出:
      IllegalArgumentException - 如果 material 不是物品
      另请参阅:
    • hasCooldown

      boolean hasCooldown(@NotNull @NotNull ItemStack item)
      检查指定物品是否处于冷却状态。

      原文:Check whether a cooldown is active on the specified item.

      参数:
      item - 要检查的物品
      返回:
      该物品是否处于冷却状态
    • getCooldown

      int getCooldown(@NotNull @NotNull ItemStack item)
      获取指定物品的剩余冷却时间(以tick为单位)。

      原文:Get the cooldown time in ticks remaining for the specified item.

      参数:
      item - 要检查的物品
      返回:
      剩余冷却时间(以tick为单位)
    • setCooldown

      void setCooldown(@NotNull @NotNull ItemStack item, int ticks)
      为指定物品设置一定tick数的冷却时间。设置为0 tick将移除冷却。

      原文:Set a cooldown on the specified item for a certain amount of ticks. ticks. 0 ticks will result in the removal of the cooldown.

      冷却被服务器用来针对某些物品比如末影珍珠、盾牌等以防止它们被经常重复使用。

      如果存在 UseCooldownComponent,则冷却会应用于当前 HumanEntity 的所有具有相同 UseCooldownComponent.getCooldownGroup() 的物品,否则冷却会应用于所有具有相同 Material 的物品。

      请注意,冷却时间本身不会阻止物品被用于攻击。

      参数:
      item - 要设置冷却的物品
      ticks - 要设置的tick数,设为0则移除冷却
      另请参阅:
    • getSleepTicks

      int getSleepTicks()
      获取玩家的睡眠时间 (以tick为单位), 该值可能有上限.

      原文:Get the sleep ticks of the player. This value may be capped.

      返回:
      玩家睡了多久
    • sleep

      boolean sleep(@NotNull @NotNull Location location, boolean force)
      尝试使实体在指定位置睡觉。

      原文:Attempts to make the entity sleep at the given location.
      该位置必须在当前世界中且放置了床。如果未设置force参数,游戏还可能强制执行其他要求,例如 与床的距离、怪物以及维度类型。

      参数:
      location - 床的位置
      force - 是否尝试在该位置睡觉,即使通常情况下不可能
      返回:
      睡觉是否成功
    • wakeup

      void wakeup(boolean setSpawnLocation)
      使玩家醒来(如果他们正在睡觉)。

      原文:Causes the player to wakeup if they are currently sleeping.

      参数:
      setSpawnLocation - 是否将重生点设置为他们当前睡觉的床
      抛出:
      IllegalStateException - 如果玩家没有在睡觉
    • startRiptideAttack

      void startRiptideAttack(int duration, float attackStrength, @Nullable @Nullable ItemStack attackItem)
      使玩家开始激流旋转攻击。

      原文:Make the player start a riptide spin attack.

      参数:
      duration - 旋转攻击持续时间(以tick为单位)
      attackStrength - 旋转攻击命中实体时造成的伤害值
      attackItem - 用于攻击的物品
    • getBedLocation

      @NotNull @NotNull Location getBedLocation()
      获取玩家当前正在睡觉的床的位置。

      原文:Gets the location of the bed the player is currently sleeping in

      返回:
      床的位置
      抛出:
      IllegalStateException - 如果玩家没有在睡觉
    • getGameMode

      @NotNull @NotNull GameMode getGameMode()
      获取此人类当前的游戏模式.

      原文:Gets this human's current GameMode

      返回:
      游戏模式
    • setGameMode

      void setGameMode(@NotNull @NotNull GameMode mode)
      设置此人类的游戏模式.

      原文:Sets this human's current GameMode

      参数:
      mode - 新游戏模式
    • isBlocking

      boolean isBlocking()
      检查玩家是否正在格挡 (换言之, 就是他们使用盾牌, 进入了格挡状态).

      原文:Check if the player is currently blocking (ie with a shield).

      返回:
      玩家是否正在格挡
    • isHandRaised

      boolean isHandRaised()
      检查玩家是否举起了他们的手 (换言之, 就是他们刚使用盾牌(这时isBlocking返回false), 数百毫秒后将进入格挡状态(这时isBlocking返回true)).

      原文:Check if the player currently has their hand raised (ie about to begin blocking).

      返回:
      玩家是否举起了他们的手
    • getExpToLevel

      int getExpToLevel()
      获取玩家升级所需经验总额.

      原文:Get the total amount of experience required for the player to level

      返回:
      升级所需经验
    • getAttackCooldown

      float getAttackCooldown()
      获取玩家攻击的当前冷却时间。

      原文:Gets the current cooldown for a player's attack. 这用于计算伤害,1.0表示完全充能的攻击,0.0表示未充能的攻击。

      返回:
      一个0.0-1.0之间的浮点数,表示充能进度
    • discoverRecipe

      boolean discoverRecipe(@NotNull @NotNull NamespacedKey recipe)
      为玩家发现一个尚未发现的配方。此方法将把该配方添加到玩家的配方书中。

      原文:Discover a recipe for this player such that it has not already been discovered. This method will add the key's associated recipe to the player's recipe book.

      参数:
      recipe - 要发现的配方的key
      返回:
      该配方是否是新发现的
    • discoverRecipes

      int discoverRecipes(@NotNull @NotNull Collection<NamespacedKey> recipes)
      为玩家发现一组尚未发现的配方。此方法将把相关配方添加到玩家的配方书中。如果集合中某个配方已被发现,它将被静默忽略。

      原文:Discover a collection of recipes for this player such that they have not already been discovered. This method will add the keys' associated recipes to the player's recipe book. If a recipe in the provided collection has already been discovered, it will be silently ignored.

      参数:
      recipes - 要发现的配方的key集合
      返回:
      新发现的配方数量,0表示没有新发现的配方,等于 recipes.size() 的数字表示所有配方都是新发现的
    • undiscoverRecipe

      boolean undiscoverRecipe(@NotNull @NotNull NamespacedKey recipe)
      取消玩家对一个已发现配方的发现状态。此方法将从玩家的配方书中移除该配方。

      原文:Undiscover a recipe for this player such that it has already been discovered. This method will remove the key's associated recipe from the player's recipe book.

      参数:
      recipe - 要取消发现的配方的key
      返回:
      配方是否被成功取消发现(即它之前已被发现)
    • undiscoverRecipes

      int undiscoverRecipes(@NotNull @NotNull Collection<NamespacedKey> recipes)
      取消玩家对一组已发现配方的发现状态。此方法将从玩家的配方书中移除这些配方。如果集合中某个配方尚未被发现,它将被静默忽略。

      原文:Undiscover a collection of recipes for this player such that they have already been discovered. This method will remove the keys' associated recipes from the player's recipe book. If a recipe in the provided collection has not yet been discovered, it will be silently ignored.

      参数:
      recipes - 要取消发现的配方的key集合
      返回:
      被取消发现的配方数量,0表示没有被取消发现的配方,等于 recipes.size() 的数字表示所有配方都被取消发现
    • hasDiscoveredRecipe

      boolean hasDiscoveredRecipe(@NotNull @NotNull NamespacedKey recipe)
      检查此实体是否已发现指定配方。

      原文:Check whether or not this entity has discovered the specified recipe.

      参数:
      recipe - 要检查的配方的key
      返回:
      如果已发现则返回true,否则返回false
    • getDiscoveredRecipes

      @NotNull @NotNull Set<NamespacedKey> getDiscoveredRecipes()
      获取此实体已发现的配方的不可变集合。

      原文:Get an immutable set of recipes this entity has discovered.

      返回:
      所有已发现的配方
    • getShoulderEntityLeft

      @Deprecated(since="1.12") @Nullable @Nullable Entity getShoulderEntityLeft()
      已过时。
      Bukkit中目前还没有关于序列化实体的语义(格式)的良好定义. 请谨慎使用.
      获取栖息在玩家左肩上的实体 (通常情况下这是鹦鹉的行为, 目前客户端没有为其他实体定义这一行为), 若没有则返回null.

      返回的实体不会在世界内生成, 因此除非这个实体是首次生成的, 大部分对该实体的操作是无效的.

      原文:Gets the entity currently perched on the left shoulder or null if no entity.
      The returned entity will not be spawned within the world, so most operations are invalid unless the entity is first spawned in.

      返回:
      坐在玩家左肩的实体
    • setShoulderEntityLeft

      @Deprecated(since="1.12") void setShoulderEntityLeft(@Nullable @Nullable Entity entity)
      已过时。
      Bukkit中目前还没有关于序列化实体的语义(格式)的良好定义. 请谨慎使用.
      设置栖息在玩家左肩上的实体(设为null则移除). 该方法将从世界中删除该实体.

      请注意: 只有实体的副本将被设置为显示在肩膀上的实体.

      也请注意游戏客户端目前只会渲染鹦鹉的坐在肩膀上的行为.

      原文:Sets the entity currently perched on the left shoulder, or null to remove. This method will remove the entity from the world.
      Note that only a copy of the entity will be set to display on the shoulder.
      Also note that the client will currently only render Parrot entities.

      参数:
      entity - 坐在玩家左肩的实体
    • getShoulderEntityRight

      @Deprecated(since="1.12") @Nullable @Nullable Entity getShoulderEntityRight()
      已过时。
      Bukkit中目前还没有关于序列化实体的语义(格式)的良好定义. 请谨慎使用.
      获取栖息在玩家右肩上的实体, 若没有则返回null.

      返回的实体不会在世界内生成, 因此除非这个实体是首次生成的, 大部分对该实体的操作是无效的.

      原文:Gets the entity currently perched on the right shoulder or null if no entity.
      The returned entity will not be spawned within the world, so most operations are invalid unless the entity is first spawned in.

      返回:
      坐在玩家右肩的实体
    • setShoulderEntityRight

      @Deprecated(since="1.12") void setShoulderEntityRight(@Nullable @Nullable Entity entity)
      已过时。
      Bukkit中目前还没有关于序列化实体的语义(格式)的良好定义. 请谨慎使用.
      设置栖息在玩家右肩上的实体(设为null则移除). 该方法将从世界中删除该实体.

      请注意: 只有实体的副本将被设置为显示在肩膀上的实体.

      也请注意游戏客户端目前只会渲染鹦鹉的坐在肩膀上的行为.

      原文:Sets the entity currently perched on the right shoulder, or null to remove. This method will remove the entity from the world.
      Note that only a copy of the entity will be set to display on the shoulder.
      Also note that the client will currently only render Parrot entities.

      参数:
      entity - 坐在玩家右肩的实体
    • dropItem

      boolean dropItem(boolean dropAll)
      使实体丢弃手中的物品。

      原文:Make the entity drop the item in their hand.
      这将强制实体丢弃他们持有的物品,可选择丢弃整个 ItemStack 或只丢弃1个物品。

      参数:
      dropAll - 设为true丢弃整个物品堆,设为false只丢弃1个物品
      返回:
      如果物品成功丢弃则返回true
    • getExhaustion

      float getExhaustion()
      获取玩家的疲劳度.

      疲劳度控制者玩家的饥饿消耗. 当玩家达到一定的疲劳度时, 你的饱食度就会下降, 并且疲劳度归零.

      译注:如果饱食度为0, 那么就扣饥饿度.

      译注2:运动会产生疲劳度.

      原文:Gets the players current exhaustion level.

      Exhaustion controls how fast the food level drops. While you have a certain amount of exhaustion, your saturation will drop to zero, and then your food will drop to zero.

      返回:
      疲劳度
    • setExhaustion

      void setExhaustion(float value)
      设置玩家的疲劳度.

      原文:Sets the players current exhaustion level

      参数:
      value - 疲劳度
    • getSaturation

      float getSaturation()
      获取玩家的饱食度(不是饥饿度).

      饱食度是一个饥饿度的缓存. 当你的饱食度 > 0的时候,饥饿度是不会下降的.

      译注:就是说, 吃东西的时候, 你的饥饿度被填满了, 而多出来的部分就是隐藏的饱食度. 当你的疲劳值(见getExhaustion()) 达到一定程度时, 如果饱食度不为0, 那么先扣饱食度. 只有当没饱食度时, 才会扣饥饿度. 其实饱食度就是饥饿度, 只不过是隐藏的.

      原文:Gets the players current saturation level.

      Saturation is a buffer for food level. Your food level will not drop if you are saturated > 0.

      返回:
      饱食度
    • setSaturation

      void setSaturation(float value)
      设置玩家的饱食度(不是饥饿度).

      原文:Sets the players current saturation level

      参数:
      value - 饱食度
    • getFoodLevel

      int getFoodLevel()
      获取玩家的饥饿度(不是饱食度).

      原文:Gets the players current food level

      返回:
      饥饿度
    • setFoodLevel

      void setFoodLevel(int value)
      设置玩家的饥饿度(不是饱食度).

      原文:Sets the players current food level

      参数:
      value - 饥饿度
    • getSaturatedRegenRate

      int getSaturatedRegenRate()
      获取玩家在有饱食度且食物等级 >= 20 时的再生速率(每x tick恢复1点生命值)。默认为10。

      原文:Get the regeneration rate (1 health per x ticks) of the HumanEntity when they have saturation and their food level is >= 20. Default is 10.

      返回:
      再生速率
    • setSaturatedRegenRate

      void setSaturatedRegenRate(int ticks)
      设置玩家在有饱食度且食物等级 >= 20 时的再生速率(每x tick恢复1点生命值)。默认为10。

      原文:Set the regeneration rate (1 health per x ticks) of the HumanEntity when they have saturation and their food level is >= 20. Default is 10. Not affected if the world's difficulty is peaceful.

      参数:
      ticks - 恢复1点生命值所需的tick数
    • getUnsaturatedRegenRate

      int getUnsaturatedRegenRate()
      获取玩家在没有饱食度且食物等级 >= 18 时的再生速率(每x tick恢复1点生命值)。默认为80。

      原文:Get the regeneration rate (1 health per x ticks) of the HumanEntity when they have no saturation and their food level is >= 18. Default is 80.

      返回:
      再生速率
    • setUnsaturatedRegenRate

      void setUnsaturatedRegenRate(int ticks)
      设置玩家在没有饱食度且食物等级 >= 18 时的再生速率(每x tick恢复1点生命值)。默认为80。

      原文:Set the regeneration rate (1 health per x ticks) of the HumanEntity when they have no saturation and their food level is >= 18. Default is 80. Not affected if the world's difficulty is peaceful.

      参数:
      ticks - 恢复1点生命值所需的tick数
    • getStarvationRate

      int getStarvationRate()
      获取玩家的饥饿速率(每x tick失去1点生命值)。默认为80。

      原文:Get the starvation rate (1 health per x ticks) of the HumanEntity. Default is 80.

      返回:
      饥饿速率
    • setStarvationRate

      void setStarvationRate(int ticks)
      设置玩家的饥饿速率(每x tick失去1点生命值)。默认为80。

      原文:Set the starvation rate (1 health per x ticks) of the HumanEntity. Default is 80.

      参数:
      ticks - 失去1点生命值所需的tick数
    • getLastDeathLocation

      @Nullable @Nullable Location getLastDeathLocation()
      获取玩家上次死亡的位置。

      原文:Gets the player's last death location.

      返回:
      上次死亡的位置,如果不存在则返回null
    • setLastDeathLocation

      void setLastDeathLocation(@Nullable @Nullable Location location)
      设置玩家上次死亡的位置。

      原文:Sets the player's last death location.
      注意:此数据仅在玩家重生时才会在玩家客户端更新。

      参数:
      location - 要设置的上次死亡位置
    • fireworkBoost

      @Nullable @Nullable Firework fireworkBoost(@NotNull @NotNull ItemStack fireworkItemStack)
      执行烟花火箭加速。

      原文:Perform a firework boost.

      此方法仅在 LivingEntity.isGliding() 为true且实体正在使用鞘翅滑翔时有效。此外,提供的 fireworkItemStack 必须是烟花火箭。加速的威力将直接关联到 FireworkMeta.getPower()。

      参数:
      fireworkItemStack - 用于滑翔的烟花火箭物品堆
      返回:
      附加的 Firework,如果实体无法被加速则返回null
      抛出:
      IllegalArgumentException - 如果fireworkItemStack不是烟花火箭