Interface HumanEntity

All Superinterfaces:
AnimalTamer, Attributable, Audience, CommandSender, Damageable, Entity, Frictional, HoverEventSource<HoverEvent.ShowEntity>, InventoryHolder, LivingEntity, Metadatable, Nameable, Permissible, PersistentDataHolder, PersistentDataViewHolder, Pointered, ProjectileSource, ServerOperator, Sound.Emitter
All Known Subinterfaces:
Player

@NullMarked public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
Represents a human entity, such as an NPC or a player
  • Method Details

    • getEquipment

      EntityEquipment getEquipment()
      Description copied from interface: LivingEntity
      Gets the inventory with the equipment worn by the living entity.
      Specified by:
      getEquipment in interface LivingEntity
      Returns:
      the living entity's inventory
    • getName

      String getName()
      Returns the name of this player
      Specified by:
      getName in interface AnimalTamer
      Specified by:
      getName in interface CommandSender
      Returns:
      Player name
    • getInventory

      PlayerInventory getInventory()
      Get the player's inventory.
      Specified by:
      getInventory in interface InventoryHolder
      Returns:
      The inventory of the player, this also contains the armor slots.
    • getEnderChest

      Inventory getEnderChest()
      Get the player's EnderChest inventory
      Returns:
      The EnderChest of the player
    • getMainHand

      MainHand getMainHand()
      Gets the player's selected main hand
      Returns:
      the players main hand
    • setWindowProperty

      @Deprecated(forRemoval=true, since="1.21") boolean setWindowProperty(InventoryView.Property prop, int value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use InventoryView and its children.
      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.
      Parameters:
      prop - The property.
      value - The value to set the property to.
      Returns:
      True if the property was successfully set.
    • getEnchantmentSeed

      int getEnchantmentSeed()
      Gets the player's current enchantment seed. The Seed is used to generate enchantment options in the enchanting table for the player.
      Returns:
      the player's enchantment seed
    • setEnchantmentSeed

      void setEnchantmentSeed(int seed)
      Sets the player's enchantment seed. The Seed is used to generate enchantment options in the enchanting table for the player.
      Parameters:
      seed - the player's new enchantment seed
    • getOpenInventory

      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.
      Returns:
      The inventory view.
    • openInventory

      @Nullable InventoryView openInventory(Inventory inventory)
      Opens an inventory window with the specified inventory on the top and the player's inventory on the bottom.
      Parameters:
      inventory - The inventory to open
      Returns:
      The newly opened inventory view
    • openWorkbench

      @Deprecated(since="1.21.4") @Nullable InventoryView openWorkbench(@Nullable Location location, boolean force)
      Deprecated.
      This method should be replaced by MenuType.CRAFTING see MenuType.Typed.builder() and its options for more information.
      Opens an empty workbench inventory window with the player's inventory on the bottom.
      Parameters:
      location - The location to attach it to. If null, the player's location is used.
      force - If false, and there is no workbench block at the location, no inventory will be opened and null will be returned.
      Returns:
      The newly opened inventory view, or null if it could not be opened.
    • openEnchanting

      @Deprecated(since="1.21.4") @Nullable InventoryView openEnchanting(@Nullable Location location, boolean force)
      Deprecated.
      This method should be replaced by MenuType.ENCHANTMENT see MenuType.Typed.builder() and its options for more information.
      Opens an empty enchanting inventory window with the player's inventory on the bottom.
      Parameters:
      location - The location to attach it to. If null, the player's location is used.
      force - If false, and there is no enchanting table at the location, no inventory will be opened and null will be returned.
      Returns:
      The newly opened inventory view, or null if it could not be opened.
    • openInventory

      void openInventory(InventoryView inventory)
      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().

      Parameters:
      inventory - The view to open
    • openMerchant

      @Deprecated(since="1.21.4") @Nullable InventoryView openMerchant(Villager trader, boolean force)
      Deprecated.
      This method can be replaced by using MenuType.MERCHANT in conjunction with openInventory(InventoryView).
      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.
      Parameters:
      trader - The merchant to trade with. Cannot be null.
      force - whether to force the trade even if another player is trading
      Returns:
      The newly opened inventory view, or null if it could not be
    • openMerchant

      @Deprecated(since="1.21.4") @Nullable InventoryView openMerchant(Merchant merchant, boolean force)
      Deprecated.
      This method can be replaced by using MenuType.MERCHANT in conjunction with openInventory(InventoryView).
      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.
      Parameters:
      merchant - The merchant to trade with. Cannot be null.
      force - whether to force the trade even if another player is trading
      Returns:
      The newly opened inventory view, or null if it could not be
    • openAnvil

      @Deprecated(since="1.21.4") @Nullable InventoryView openAnvil(@Nullable Location location, boolean force)
      Deprecated.
      This method should be replaced by MenuType.ANVIL see MenuType.Typed.builder() and its options for more information.
      Opens an empty anvil inventory window with the player's inventory on the bottom.
      Parameters:
      location - The location to attach it to. If null, the player's location is used.
      force - If false, and there is no anvil block at the location, no inventory will be opened and null will be returned.
      Returns:
      The newly opened inventory view, or null if it could not be opened.
    • openCartographyTable

      @Deprecated(since="1.21.4") @Nullable InventoryView openCartographyTable(@Nullable Location location, boolean force)
      Deprecated.
      This method should be replaced by MenuType.CARTOGRAPHY_TABLE see MenuType.Typed.builder() and its options for more information.
      Opens an empty cartography table inventory window with the player's inventory on the bottom.
      Parameters:
      location - The location to attach it to. If null, the player's location is used.
      force - If false, and there is no cartography table block at the location, no inventory will be opened and null will be returned.
      Returns:
      The newly opened inventory view, or null if it could not be opened.
    • openGrindstone

      @Deprecated(since="1.21.4") @Nullable InventoryView openGrindstone(@Nullable Location location, boolean force)
      Deprecated.
      This method should be replaced by MenuType.GRINDSTONE see MenuType.Typed.builder() and its options for more information.
      Opens an empty grindstone inventory window with the player's inventory on the bottom.
      Parameters:
      location - The location to attach it to. If null, the player's location is used.
      force - If false, and there is no grindstone block at the location, no inventory will be opened and null will be returned.
      Returns:
      The newly opened inventory view, or null if it could not be opened.
    • openLoom

      @Deprecated(since="1.21.4") @Nullable InventoryView openLoom(@Nullable Location location, boolean force)
      Deprecated.
      This method should be replaced by MenuType.LOOM see MenuType.Typed.builder() and its options for more information.
      Opens an empty loom inventory window with the player's inventory on the bottom.
      Parameters:
      location - The location to attach it to. If null, the player's location is used.
      force - If false, and there is no loom block at the location, no inventory will be opened and null will be returned.
      Returns:
      The newly opened inventory view, or null if it could not be opened.
    • openSmithingTable

      @Deprecated(since="1.21.4") @Nullable InventoryView openSmithingTable(@Nullable Location location, boolean force)
      Deprecated.
      This method should be replaced by MenuType.SMITHING see MenuType.Typed.builder() and its options for more information.
      Opens an empty smithing table inventory window with the player's inventory on the bottom.
      Parameters:
      location - The location to attach it to. If null, the player's location is used.
      force - If false, and there is no smithing table block at the location, no inventory will be opened and null will be returned.
      Returns:
      The newly opened inventory view, or null if it could not be opened.
    • openStonecutter

      @Deprecated(since="1.21.4") @Nullable InventoryView openStonecutter(@Nullable Location location, boolean force)
      Deprecated.
      This method should be replaced by MenuType.STONECUTTER see MenuType.Typed.builder() and its options for more information.
      Opens an empty stonecutter inventory window with the player's inventory on the bottom.
      Parameters:
      location - The location to attach it to. If null, the player's location is used.
      force - If false, and there is no stonecutter block at the location, no inventory will be opened and null will be returned.
      Returns:
      The newly opened inventory view, or null if it could not be opened.
    • closeInventory

      void closeInventory()
      Force-closes the currently open inventory view for this player, if any.
    • closeInventory

      void closeInventory(InventoryCloseEvent.Reason reason)
      Force-closes the currently open inventory view for this player, if any.
      Parameters:
      reason - why the inventory is closing
    • getItemInHand

      @Deprecated(since="1.9") ItemStack getItemInHand()
      Deprecated.
      Humans may now dual wield in their off hand, use explicit methods in PlayerInventory.
      Returns the ItemStack currently in your hand, can be empty.
      Returns:
      The ItemStack of the item you are currently holding.
    • setItemInHand

      @Deprecated(since="1.9") void setItemInHand(@Nullable ItemStack item)
      Deprecated.
      Humans may now dual wield in their off hand, use explicit methods in PlayerInventory.
      Sets the item to the given ItemStack, this will replace whatever the user was holding.
      Parameters:
      item - The ItemStack which will end up in the hand
    • getItemOnCursor

      ItemStack getItemOnCursor()
      Returns the ItemStack currently on your cursor, can be empty. Will always be empty if the player currently has no open window.
      Returns:
      The ItemStack of the item you are currently moving around.
    • setItemOnCursor

      void setItemOnCursor(@Nullable ItemStack item)
      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.
      Parameters:
      item - The ItemStack which will end up in the hand
    • hasCooldown

      boolean hasCooldown(Material material)
      Check whether a cooldown is active on the specified material.
      Parameters:
      material - the material to check
      Returns:
      if a cooldown is active on the material
      Throws:
      IllegalArgumentException - if the material is not an item
    • getCooldown

      int getCooldown(Material material)
      Get the cooldown time in ticks remaining for the specified material.
      Parameters:
      material - the material to check
      Returns:
      the remaining cooldown time in ticks
      Throws:
      IllegalArgumentException - if the material is not an item
    • setCooldown

      void setCooldown(Material material, int ticks)
      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.

      Parameters:
      material - the material to set the cooldown for
      ticks - the amount of ticks to set or 0 to remove
      Throws:
      IllegalArgumentException - if the material is not an item
    • setHurtDirection

      void setHurtDirection(float hurtDirection)
      Sets player hurt direction
      Specified by:
      setHurtDirection in interface LivingEntity
      Parameters:
      hurtDirection - hurt direction
    • isDeeplySleeping

      boolean isDeeplySleeping()
      If the player has slept enough to count towards passing the night.
      Returns:
      true if the player has slept enough
    • hasCooldown

      boolean hasCooldown(ItemStack item)
      Check whether a cooldown is active on the specified item.
      Parameters:
      item - the item to check
      Returns:
      if a cooldown is active on the item
    • getCooldown

      int getCooldown(ItemStack item)
      Get the cooldown time in ticks remaining for the specified item.
      Parameters:
      item - the item to check
      Returns:
      the remaining cooldown time in ticks
    • setCooldown

      void setCooldown(ItemStack item, int ticks)
      Set a cooldown on the specified item 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.

      Parameters:
      item - the item to set the cooldown for
      ticks - the amount of ticks to set or 0 to remove
    • getSleepTicks

      int getSleepTicks()
      Get the sleep ticks of the player. This value may be capped.
      Returns:
      slumber ticks
    • getPotentialBedLocation

      @Deprecated(since="1.21.4") default @Nullable Location getPotentialBedLocation()
      Deprecated.
      Misleading name. This method also returns the location of respawn anchors.
      Gets the Location of the player's bed, null if they have not slept in one. This method will not attempt to validate if the current bed is still valid.
      Returns:
      Bed Location if has slept in one, otherwise null.
      See Also:
    • getPotentialRespawnLocation

      @Nullable Location getPotentialRespawnLocation()
      Gets the Location where the player will spawn at, null if they don't have a valid respawn point. This method will not attempt to validate if the current respawn location is still valid.
      Returns:
      respawn location if exists, otherwise null.
    • getFishHook

      @Nullable FishHook getFishHook()
      Returns:
      the player's fishing hook if they are fishing
    • sleep

      boolean sleep(Location location, boolean force)
      Attempts to make the entity sleep at the given location.
      The location must be in the current world and have a bed placed at the location. The game may also enforce other requirements such as proximity to bed, monsters, and dimension type if force is not set.
      Parameters:
      location - the location of the bed
      force - whether to try and sleep at the location even if not normally possible
      Returns:
      whether the sleep was successful
    • wakeup

      void wakeup(boolean setSpawnLocation)
      Causes the player to wakeup if they are currently sleeping.
      Parameters:
      setSpawnLocation - whether to set their spawn location to the bed they are currently sleeping in
      Throws:
      IllegalStateException - if not sleeping
    • startRiptideAttack

      void startRiptideAttack(int duration, float attackStrength, @Nullable ItemStack attackItem)
      Make the player start a riptide spin attack.
      Parameters:
      duration - spin attack duration in ticks.
      attackStrength - damage value inflicted upon entities hit by spin attack.
      attackItem - item used to attack.
    • getBedLocation

      Location getBedLocation()
      Gets the location of the bed the player is currently sleeping in
      Returns:
      location
      Throws:
      IllegalStateException - if not sleeping
    • getGameMode

      GameMode getGameMode()
      Gets this human's current GameMode
      Returns:
      Current game mode
    • setGameMode

      void setGameMode(GameMode mode)
      Sets this human's current GameMode
      Parameters:
      mode - New game mode
    • isBlocking

      boolean isBlocking()
      Check if the player is currently blocking (ie with a shield).
      Returns:
      Whether they are blocking.
    • isHandRaised

      @Obsolete(since="1.20.4") boolean isHandRaised()
      Check if the player currently has their hand raised (ie about to begin blocking).
      Specified by:
      isHandRaised in interface LivingEntity
      Returns:
      Whether their hand is raised
      See Also:
    • getExpToLevel

      int getExpToLevel()
      Get the total amount of experience required for the player to level
      Returns:
      Experience required to level up
    • releaseLeftShoulderEntity

      @Nullable Entity releaseLeftShoulderEntity()
      If there is an Entity on this entities left shoulder, it will be released to the world and returned. If no Entity is released, null will be returned.
      Returns:
      The released entity, or null
    • releaseRightShoulderEntity

      @Nullable Entity releaseRightShoulderEntity()
      If there is an Entity on this entities left shoulder, it will be released to the world and returned. If no Entity is released, null will be returned.
      Returns:
      The released entity, or null
    • getAttackCooldown

      float getAttackCooldown()
      Gets the current cooldown for a player's attack. This is used to calculate damage, with 1.0 representing a fully charged attack and 0.0 representing a non-charged attack
      Returns:
      A float between 0.0-1.0 representing the progress of the charge
    • discoverRecipe

      boolean discoverRecipe(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.
      Parameters:
      recipe - the key of the recipe to discover
      Returns:
      whether or not the recipe was newly discovered
    • discoverRecipes

      int discoverRecipes(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.
      Parameters:
      recipes - the keys of the recipes to discover
      Returns:
      the amount of newly discovered recipes where 0 indicates that none were newly discovered and a number equal to recipes.size() indicates that all were new
    • undiscoverRecipe

      boolean undiscoverRecipe(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.
      Parameters:
      recipe - the key of the recipe to undiscover
      Returns:
      whether or not the recipe was successfully undiscovered (i.e. it was previously discovered)
    • undiscoverRecipes

      int undiscoverRecipes(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.
      Parameters:
      recipes - the keys of the recipes to undiscover
      Returns:
      the amount of undiscovered recipes where 0 indicates that none were undiscovered and a number equal to recipes.size() indicates that all were undiscovered
    • hasDiscoveredRecipe

      boolean hasDiscoveredRecipe(NamespacedKey recipe)
      Check whether or not this entity has discovered the specified recipe.
      Parameters:
      recipe - the key of the recipe to check
      Returns:
      true if discovered, false otherwise
    • getDiscoveredRecipes

      Set<NamespacedKey> getDiscoveredRecipes()
      Get an immutable set of recipes this entity has discovered.
      Returns:
      all discovered recipes
    • getShoulderEntityLeft

      @Deprecated(since="1.12") @Nullable Entity getShoulderEntityLeft()
      Deprecated.
      There are currently no well defined semantics regarding serialized entities in Bukkit. Use with care.
      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.
      Returns:
      left shoulder entity
    • setShoulderEntityLeft

      @Deprecated(since="1.12") void setShoulderEntityLeft(@Nullable Entity entity)
      Deprecated.
      There are currently no well defined semantics regarding serialized entities in Bukkit. Use with care.
      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.
      Parameters:
      entity - left shoulder entity
    • getShoulderEntityRight

      @Deprecated(since="1.12") @Nullable Entity getShoulderEntityRight()
      Deprecated.
      There are currently no well defined semantics regarding serialized entities in Bukkit. Use with care.
      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.
      Returns:
      right shoulder entity
    • setShoulderEntityRight

      @Deprecated(since="1.12") void setShoulderEntityRight(@Nullable Entity entity)
      Deprecated.
      There are currently no well defined semantics regarding serialized entities in Bukkit. Use with care.
      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.
      Parameters:
      entity - right shoulder entity
    • openSign

      @Deprecated default void openSign(Sign sign)
      Opens an editor window for the specified sign
      Parameters:
      sign - The sign to open
    • openSign

      void openSign(Sign sign, Side side)
      Opens an editor window for the specified sign
      Parameters:
      sign - The sign to open
      side - The side of the sign to open
    • dropItem

      @Obsolete(since="1.21.4") boolean dropItem(boolean dropAll)
      Make the entity drop the item in their hand.
      This will force the entity to drop the item they are holding with an option to drop the entire ItemStack or just 1 of the items.
      Parameters:
      dropAll - True to drop entire stack, false to drop 1 of the stack
      Returns:
      True if item was dropped successfully
      API Note:
      You should instead use dropItem(EquipmentSlot, int) or dropItem(EquipmentSlot) with a EquipmentSlot.HAND parameter.
    • dropItem

      default @Nullable Item dropItem(int slot)
      Makes the player drop all items from their inventory based on the inventory slot.
      Parameters:
      slot - the equipment slot to drop
      Returns:
      the dropped item entity, or null if the action was unsuccessful
    • dropItem

      default @Nullable Item dropItem(int slot, int amount)
      Makes the player drop an item from their inventory based on the inventory slot.
      Parameters:
      slot - the slot to drop
      amount - the number of items to drop from this slot. Values below one always return null
      Returns:
      the dropped item entity, or null if the action was unsuccessful
      Throws:
      IllegalArgumentException - if the slot is negative or bigger than the player's inventory
    • dropItem

      @Nullable Item dropItem(int slot, int amount, boolean throwRandomly, @Nullable Consumer<Item> entityOperation)
      Makes the player drop an item from their inventory based on the inventory slot.
      Parameters:
      slot - the slot to drop
      amount - the number of items to drop from this slot. Values below one always return null
      throwRandomly - controls the randomness of the dropped items velocity, where true mimics dropped items during a player's death, while false acts like a normal item drop.
      entityOperation - the function to be run before adding the entity into the world
      Returns:
      the dropped item entity, or null if the action was unsuccessful
      Throws:
      IllegalArgumentException - if the slot is negative or bigger than the player's inventory
    • dropItem

      default @Nullable Item dropItem(EquipmentSlot slot)
      Makes the player drop all items from their inventory based on the equipment slot.
      Parameters:
      slot - the equipment slot to drop
      Returns:
      the dropped item entity, or null if the action was unsuccessful
    • dropItem

      default @Nullable Item dropItem(EquipmentSlot slot, int amount)
      Makes the player drop an item from their inventory based on the equipment slot.
      Parameters:
      slot - the equipment slot to drop
      amount - the amount of items to drop from this equipment slot. Values below one always return null
      Returns:
      the dropped item entity, or null if the action was unsuccessful
    • dropItem

      @Nullable Item dropItem(EquipmentSlot slot, int amount, boolean throwRandomly, @Nullable Consumer<Item> entityOperation)
      Makes the player drop an item from their inventory based on the equipment slot.
      Parameters:
      slot - the equipment slot to drop
      amount - The amount of items to drop from this equipment slot. Values below one always return null
      throwRandomly - controls the randomness of the dropped items velocity, where true mimics dropped items during a player's death, while false acts like a normal item drop.
      entityOperation - the function to be run before adding the entity into the world
      Returns:
      the dropped item entity, or null if the action was unsuccessful
    • dropItem

      default @Nullable Item dropItem(ItemStack itemStack)
      Makes the player drop any arbitrary ItemStack, independently of whether the player actually has that item in their inventory.

      This method modifies neither the item nor the player's inventory. Item removal has to be handled by the method caller.

      Parameters:
      itemStack - the itemstack to drop
      Returns:
      the dropped item entity, or null if the action was unsuccessful
    • dropItem

      @Nullable Item dropItem(ItemStack itemStack, boolean throwRandomly, @Nullable Consumer<Item> entityOperation)
      Makes the player drop any arbitrary ItemStack, independently of whether the player actually has that item in their inventory.

      This method modifies neither the item nor the player's inventory. Item removal has to be handled by the method caller.

      Parameters:
      itemStack - the itemstack to drop
      throwRandomly - controls the randomness of the dropped items velocity, where true mimics dropped items during a player's death, while false acts like a normal item drop.
      entityOperation - the function to be run before adding the entity into the world
      Returns:
      the dropped item entity, or null if the action was unsuccessful
    • getExhaustion

      float getExhaustion()
      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.

      Returns:
      Exhaustion level
    • setExhaustion

      void setExhaustion(float value)
      Sets the players current exhaustion level
      Parameters:
      value - Exhaustion level
    • getSaturation

      float getSaturation()
      Gets the players current saturation level.

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

      Returns:
      Saturation level
    • setSaturation

      void setSaturation(float value)
      Sets the players current saturation level
      Parameters:
      value - Saturation level
    • getFoodLevel

      int getFoodLevel()
      Gets the players current food level
      Returns:
      Food level
    • setFoodLevel

      void setFoodLevel(int value)
      Sets the players current food level
      Parameters:
      value - New food level
    • getSaturatedRegenRate

      int getSaturatedRegenRate()
      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.
      Returns:
      the regeneration rate
    • setSaturatedRegenRate

      void setSaturatedRegenRate(int ticks)
      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.
      Parameters:
      ticks - the amount of ticks to gain 1 health.
    • getUnsaturatedRegenRate

      int getUnsaturatedRegenRate()
      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.
      Returns:
      the regeneration rate
    • setUnsaturatedRegenRate

      void setUnsaturatedRegenRate(int ticks)
      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. Not affected if the world's difficulty is peaceful.
      Parameters:
      ticks - the amount of ticks to gain 1 health.
    • getStarvationRate

      int getStarvationRate()
      Get the starvation rate (1 health per x ticks) of the HumanEntity. Default is 80.
      Returns:
      the starvation rate
    • setStarvationRate

      void setStarvationRate(int ticks)
      Get the starvation rate (1 health per x ticks) of the HumanEntity. Default is 80.
      Parameters:
      ticks - the amount of ticks to lose 1 health
    • getLastDeathLocation

      @Nullable Location getLastDeathLocation()
      Gets the player's last death location.
      Returns:
      the last death location if it exists, otherwise null.
    • setLastDeathLocation

      void setLastDeathLocation(@Nullable Location location)
      Sets the player's last death location.
      Note: This data is updated in the player's client only when the player respawns.
      Parameters:
      location - where to set the last death player location
    • fireworkBoost

      @Nullable Firework fireworkBoost(ItemStack fireworkItemStack)
      Perform a firework boost.

      This method will only work such that LivingEntity.isGliding() is true and the entity is actively gliding with an elytra. Additionally, the supplied fireworkItemStack must be a firework rocket. The power of the boost will directly correlate to FireworkMeta.getPower().

      Parameters:
      fireworkItemStack - the firework item stack to use to glide
      Returns:
      the attached Firework, or null if the entity could not be boosted
      Throws:
      IllegalArgumentException - if the fireworkItemStack is not a firework