接口 EntityEquipment


public interface EntityEquipment
生物的背包界面接口
  • 方法详细资料

    • setItem

      Stores the ItemStack at the given equipment slot in the inventory.
      参数:
      slot - the slot to put the ItemStack
      item - the ItemStack to set
    • setItem

      void setItem(@NotNull @NotNull EquipmentSlot slot, @Nullable @Nullable ItemStack item, boolean silent)
      Stores the ItemStack at the given equipment slot in the inventory.
      参数:
      slot - the slot to put the ItemStack
      item - the ItemStack to set
      silent - whether or not the equip sound should be silenced
    • getItem

      Gets the ItemStack at the given equipment slot in the inventory.
      参数:
      slot - the slot to get the ItemStack
      返回:
      the ItemStack in the given slot
    • getItemInMainHand

      @NotNull @NotNull ItemStack getItemInMainHand()
      获取实体当前主手中手持的物品的拷贝.

      原文: Gets a copy of the item the entity is currently holding in their main hand.

      返回:
      当前主手手持的物品
    • setItemInMainHand

      void setItemInMainHand(@Nullable @Nullable ItemStack item)
      设置实体在主手中手持的物品.

      原文: Sets the item the entity is holding in their main hand.

      参数:
      item - 需要设置的物品
    • setItemInMainHand

      void setItemInMainHand(@Nullable @Nullable ItemStack item, boolean silent)
      设置实体在主手中手持的物品.

      原文:Sets the item the entity is holding in their main hand.

      参数:
      item - 需要设置的物品
      silent - 是否播放装备动作的声音
    • getItemInOffHand

      @NotNull @NotNull ItemStack getItemInOffHand()
      获取实体当前副手中手持的物品的拷贝.

      原文: Gets a copy of the item the entity is currently holding in their off hand.

      返回:
      当前副手手持的物品
    • setItemInOffHand

      void setItemInOffHand(@Nullable @Nullable ItemStack item)
      设置实体在副手中手持的物品.

      原文: Sets the item the entity is holding in their off hand.

      参数:
      item - 需要设置的物品
    • setItemInOffHand

      void setItemInOffHand(@Nullable @Nullable ItemStack item, boolean silent)
      设置实体在副手中手持的物品.

      原文: Sets the item the entity is holding in their off hand.

      参数:
      item - 需要设置的物品
      silent - 是否播放装备动作的声音
    • getItemInHand

      已过时。
      现在实体可以双持, 所以需要特定的方法来获取指定的手
      获取实体当前所持物品的拷贝.

      译注: 反编译其实现, 发现其也是获取主手的物品.

      原文: Gets a copy of the item the entity is currently holding

      返回:
      the currently held item
      另请参阅:
    • setItemInHand

      @Deprecated void setItemInHand(@Nullable @Nullable ItemStack stack)
      已过时。
      现在实体可以双持, 所以需要特定的方法来获取指定的手
      设置实体当前所持的物品.

      译注: 反编译其实现, 发现其也是设置主手的物品.

      原文: Sets the item the entity is holding

      参数:
      stack - 需要设置的物品
      另请参阅:
    • getHelmet

      获取该实体当前正在佩戴的头盔的拷贝.

      原文: Gets a copy of the helmet currently being worn by the entity

      返回:
      所佩戴的头盔
    • setHelmet

      void setHelmet(@Nullable @Nullable ItemStack helmet)
      设置该实体当前正在佩戴的头盔.

      原文: Sets the helmet worn by the entity

      参数:
      helmet - 给定的头盔
    • setHelmet

      void setHelmet(@Nullable @Nullable ItemStack helmet, boolean silent)
      设置该实体当前正在佩戴的头盔.

      原文: Sets the helmet worn by the entity

      参数:
      helmet - 给定的头盔
      silent - 是否播放装备动作的声音
    • getChestplate

      @Nullable @Nullable ItemStack getChestplate()
      获取该实体当前正在穿戴的胸甲的拷贝.

      原文: Gets a copy of the chest plate currently being worn by the entity

      返回:
      实体所穿戴的胸甲
    • setChestplate

      void setChestplate(@Nullable @Nullable ItemStack chestplate)
      设置该实体当前正在穿戴的胸甲.

      原文: Sets the chest plate worn by the entity

      参数:
      chestplate - 给定的胸甲
    • setChestplate

      void setChestplate(@Nullable @Nullable ItemStack chestplate, boolean silent)
      设置该实体当前正在穿戴的胸甲.

      原文: Sets the chest plate worn by the entity

      参数:
      chestplate - 给定的胸甲
      silent - 是否播放装备动作的声音
    • getLeggings

      获取该实体当前正在穿戴的护腿的拷贝.

      原文: Gets a copy of the leggings currently being worn by the entity

      返回:
      实体所穿戴的护腿
    • setLeggings

      void setLeggings(@Nullable @Nullable ItemStack leggings)
      设置该实体当前正在穿戴的护腿.

      原文: Sets the leggings worn by the entity

      参数:
      leggings - 给定的护腿
    • setLeggings

      void setLeggings(@Nullable @Nullable ItemStack leggings, boolean silent)
      设置该实体当前正在穿戴的护腿.

      原文: Sets the leggings worn by the entity

      参数:
      leggings - 给定的护腿
      silent - 是否播放装备动作的声音
    • getBoots

      获取该实体当前正在穿戴的鞋子的拷贝.

      原文: Gets a copy of the boots currently being worn by the entity

      返回:
      实体所穿戴的鞋子
    • setBoots

      void setBoots(@Nullable @Nullable ItemStack boots)
      设置该实体当前正在穿戴的鞋子.

      原文: Sets the boots worn by the entity

      参数:
      boots - 给定的鞋子
    • setBoots

      void setBoots(@Nullable @Nullable ItemStack boots, boolean silent)
      设置该实体当前正在穿戴的鞋子.

      原文: Sets the boots worn by the entity

      参数:
      boots - 给定的鞋子
      silent - 是否播放装备动作的声音
    • getArmorContents

      @NotNull @NotNull ItemStack[] getArmorContents()
      获得实体当前所有穿着盔甲的拷贝.

      译注: 其顺序为 鞋子、护腿、胸甲、头盔

      原文: Gets a copy of all worn armor

      返回:
      一个关于实体当前所有穿着的盔甲的数组. 个别条目可能为null
    • setArmorContents

      void setArmorContents(@NotNull @NotNull ItemStack[] items)
      将实体所穿戴的盔甲设置为提供的ItemStacks数组.

      译注:

      • 该ItemStack数组的顺序应为 鞋子、护腿、胸甲、头盔
      • 当数组长度不够4个时, 将会把剩下的设置为null, 如为2时,胸甲和头盔将会自动设置为null

      原文: Sets the entities armor to the provided array of ItemStacks

      参数:
      items - 给定的盔甲数组. 个别条目可以为null
    • clear

      void clear()
      清除实体所有的盔甲和手持的物品.

      原文: Clears the entity of all armor and held items

    • getItemInHandDropChance

      @Deprecated float getItemInHandDropChance()
      已过时。
      现在实体可以双持, 所以需要特定的方法来设置指定的手
      返回:
      掉落的几率
      另请参阅:
    • setItemInHandDropChance

      @Deprecated void setItemInHandDropChance(float chance)
      已过时。
      现在实体可以双持, 所以需要特定的方法来设置指定的手
      参数:
      chance - 给定的掉落几率
      另请参阅:
    • getItemInMainHandDropChance

      float getItemInMainHandDropChance()
      获得该生物在死亡时掉落其主手的物品的几率.

      原文: Gets the chance of the main hand item being dropped upon this creature's death.

      • 当掉落几率为0.0F时, 则永远不会掉落
      • 当掉落几率为1.0F时, 则总是会掉落
      返回:
      当前生物在死亡时掉落主手物品的几率(在原版里, 对于非Mob类实体来说是1.0F)
    • setItemInMainHandDropChance

      void setItemInMainHandDropChance(float chance)
      设置该生物在死亡时掉落其主手的物品的几率.

      原文: Sets the chance of the item this creature is currently holding in their main hand being dropped upon this creature's death.

      • 当掉落几率为0.0F时, 则永远不会掉落
      • 当掉落几率为1.0F时, 则总是会掉落
      参数:
      chance - 主手掉落物品的几率
      抛出:
      UnsupportedOperationException - 当这一操作作用在非Mob类实体时抛出此异常
    • getItemInOffHandDropChance

      float getItemInOffHandDropChance()
      获得该生物在死亡时掉落其副手的物品的几率.

      原文: Gets the chance of the off hand item being dropped upon this creature's death.

      • 当掉落几率为0.0F时, 则永远不会掉落
      • 当掉落几率为1.0F时, 则总是会掉落
      返回:
      当前生物在死亡时掉落副手物品的几率(在原版里, 对于非Mob类实体来说是1.0F)
    • setItemInOffHandDropChance

      void setItemInOffHandDropChance(float chance)
      设置该生物在死亡时掉落其副手的物品的几率.

      原文: Sets the chance of the off hand item being dropped upon this creature's death.

      • 当掉落几率为0.0F时, 则永远不会掉落
      • 当掉落几率为1.0F时, 则总是会掉落
      参数:
      chance - 副手掉落物品的几率
      抛出:
      UnsupportedOperationException - 当这一操作作用在非Mob类实体时抛出此异常
    • getHelmetDropChance

      float getHelmetDropChance()
      获得该生物在死亡时掉落其头盔的几率.

      原文: Gets the chance of the helmet being dropped upon this creature's death.

      • 当掉落几率为0.0F时, 则永远不会掉落
      • 当掉落几率为1.0F时, 则总是会掉落
      返回:
      当前生物在死亡时掉落头盔的几率(在原版里, 对于非Mob类实体来说是1.0F)
    • setHelmetDropChance

      void setHelmetDropChance(float chance)
      设置该生物在死亡时掉落其头盔的几率.

      原文: Sets the chance of the helmet being dropped upon this creature's death.

      • 当掉落几率为0.0F时, 则永远不会掉落
      • 当掉落几率为1.0F时, 则总是会掉落
      参数:
      chance - 掉落头盔的几率
      抛出:
      UnsupportedOperationException - 当这一操作作用在非Mob类实体时抛出此异常
    • getChestplateDropChance

      float getChestplateDropChance()
      获得该生物在死亡时掉落其胸甲的几率.

      原文: Gets the chance of the chest plate being dropped upon this creature's death.

      • 当掉落几率为0.0F时, 则永远不会掉落
      • 当掉落几率为1.0F时, 则总是会掉落
      返回:
      当前生物在死亡时掉落胸甲的几率(在原版里, 对于非Mob类实体来说是1.0F)
    • setChestplateDropChance

      void setChestplateDropChance(float chance)
      设置该生物在死亡时掉落其胸甲的几率.

      原文: Sets the chance of the chest plate being dropped upon this creature's death.

      • 当掉落几率为0.0F时, 则永远不会掉落
      • 当掉落几率为1.0F时, 则总是会掉落
      参数:
      chance - 掉落胸甲的几率
      抛出:
      UnsupportedOperationException - 当这一操作作用在非Mob类实体时抛出此异常
    • getLeggingsDropChance

      float getLeggingsDropChance()
      获得该生物在死亡时掉落其护腿的几率.

      原文: Gets the chance of the leggings being dropped upon this creature's death.

      • 当掉落几率为0.0F时, 则永远不会掉落
      • 当掉落几率为1.0F时, 则总是会掉落
      返回:
      当前生物在死亡时掉落护腿的几率(在原版里, 对于非Mob类实体来说是1.0F)
    • setLeggingsDropChance

      void setLeggingsDropChance(float chance)
      设置该生物在死亡时掉落其护腿的几率.

      原文: Sets the chance of the leggings being dropped upon this creature's death.

      • 当掉落几率为0.0F时, 则永远不会掉落
      • 当掉落几率为1.0F时, 则总是会掉落
      参数:
      chance - 掉落护腿的几率
      抛出:
      UnsupportedOperationException - 当这一操作作用在非Mob类实体时抛出此异常
    • getBootsDropChance

      float getBootsDropChance()
      获得该生物在死亡时掉落其鞋子的几率.

      原文: Gets the chance of the boots being dropped upon this creature's death.

      • 当掉落几率为0.0F时, 则永远不会掉落
      • 当掉落几率为1.0F时, 则总是会掉落
      返回:
      当前生物在死亡时掉落鞋子的几率(在原版里, 对于非Mob类实体来说是1.0F)
    • setBootsDropChance

      void setBootsDropChance(float chance)
      设置该生物在死亡时掉落其鞋子的几率.

      原文: Sets the chance of the boots being dropped upon this creature's death.

      • 当掉落几率为0.0F时, 则永远不会掉落
      • 当掉落几率为1.0F时, 则总是会掉落
      参数:
      chance - 掉落鞋子的几率
      抛出:
      UnsupportedOperationException - 当这一操作作用在非Mob类实体时抛出此异常
    • getHolder

      获取此EntityEquipment所属的实体.

      原文: Get the entity this EntityEquipment belongs to

      返回:
      这个EntityEquipment所属的实体