接口 HumanEntity
- 所有超级接口:
AnimalTamer
,Attributable
,CommandSender
,Damageable
,Entity
,InventoryHolder
,LivingEntity
,Metadatable
,Nameable
,Permissible
,PersistentDataHolder
,ProjectileSource
,ServerOperator
- 所有已知子接口:
Player
-
嵌套类概要
从接口继承的嵌套类/接口 org.bukkit.entity.Entity
Entity.Spigot
-
方法概要
修饰符和类型方法说明void
强制关闭玩家当前打开的物品栏视图.boolean
discoverRecipe
(@NotNull NamespacedKey recipe) Discover a recipe for this player such that it has not already been discovered.int
discoverRecipes
(@NotNull Collection<NamespacedKey> recipes) Discover a collection of recipes for this player such that they have not already been discovered.boolean
dropItem
(boolean dropAll) Make the entity drop the item in their hand.fireworkBoost
(@NotNull ItemStack fireworkItemStack) Perform a firework boost.float
Gets the current cooldown for a player's attack.Gets the location of the bed the player is currently sleeping inint
getCooldown
(@NotNull Material material) 获取指定物品的冷却时长 (以tick为单位).Get an immutable set of recipes this entity has discovered.int
Gets the player's current enchantment seed.获取玩家的末影箱物品栏.float
获取玩家的疲劳度.int
获取玩家升级所需经验总额.int
获取玩家的饥饿度(不是饱食度).获取此人类当前的游戏模式
.获取玩家的物品栏(俗称背包).已过时。返回你的鼠标正在拖动的物品, 可能为空.Gets the player's last death location.获取玩家设置的主手.getName()
返回该玩家的玩家名.获取玩家正在查看的物品栏.int
Get the regeneration rate (1 health per x ticks) of the HumanEntity when they have saturation and their food level is >= 20.float
获取玩家的饱食度(不是饥饿度).已过时。Bukkit中目前还没有关于序列化实体的语义(格式)的良好定义.已过时。Bukkit中目前还没有关于序列化实体的语义(格式)的良好定义.int
获取玩家的睡眠时间 (以tick为单位), 该值可能有上限.int
Get the starvation rate (1 health per x ticks) of the HumanEntity.int
Get the regeneration rate (1 health per x ticks) of the HumanEntity when they have no saturation and their food level is >= 18.boolean
hasCooldown
(@NotNull Material material) 检查指定物品是否处于冷却状态.boolean
hasDiscoveredRecipe
(@NotNull NamespacedKey recipe) Check whether or not this entity has discovered the specified recipe.boolean
检查玩家是否正在格挡 (换言之, 就是他们使用盾牌, 进入了格挡状态).boolean
检查玩家是否举起了他们的手 (换言之, 就是他们刚使用盾牌(这时isBlocking返回false), 数百毫秒后将进入格挡状态(这时isBlocking返回true)).openEnchanting
(@Nullable Location location, boolean force) 打开一个空白附魔台物品栏界面, 玩家物品栏(背包)在底部.openInventory
(@NotNull Inventory inventory) 打开一个物品栏, 窗口顶部为你指定的物品栏, 底部为玩家物品栏(背包).void
openInventory
(@NotNull InventoryView inventory) 打开指定的物品栏.openMerchant
(@NotNull Villager trader, boolean force) 与某村民开始交易.openMerchant
(@NotNull Merchant merchant, boolean force) 与某商人开始交易.openWorkbench
(@Nullable Location location, boolean force) 打开一个空白工作台物品栏界面, 玩家物品栏(背包)在底部.void
setCooldown
(@NotNull Material material, int ticks) 设置指定物品的冷却时长.void
setEnchantmentSeed
(int seed) Sets the player's enchantment seed.void
setExhaustion
(float value) 设置玩家的疲劳度.void
setFoodLevel
(int value) 设置玩家的饥饿度(不是饱食度).void
setGameMode
(@NotNull GameMode mode) 设置此人类的游戏模式
.void
setItemInHand
(@Nullable ItemStack item) 已过时。人类现能双持, 请使用PlayerInventory
中更明确的方法void
设置你正在拖动的物品, 将替换你所拖动的任何物品.void
setLastDeathLocation
(@Nullable Location location) Sets the player's last death location.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.void
setSaturation
(float value) 设置玩家的饱食度(不是饥饿度).void
setShoulderEntityLeft
(@Nullable Entity entity) 已过时。Bukkit中目前还没有关于序列化实体的语义(格式)的良好定义.void
setShoulderEntityRight
(@Nullable Entity entity) 已过时。Bukkit中目前还没有关于序列化实体的语义(格式)的良好定义.void
setStarvationRate
(int ticks) Get the starvation rate (1 health per x ticks) of the HumanEntity.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.boolean
setWindowProperty
(InventoryView.Property prop, int value) 若玩家当前打开了一个物品栏窗口, 此方法将设置窗口的属性, 比如酿造台的酿造进度.boolean
Attempts to make the entity sleep at the given location.boolean
undiscoverRecipe
(@NotNull NamespacedKey recipe) Undiscover a recipe for this player such that it has already been discovered.int
undiscoverRecipes
(@NotNull Collection<NamespacedKey> recipes) Undiscover a collection of recipes for this player such that they have already been discovered.void
wakeup
(boolean setSpawnLocation) Causes the player to wakeup if they are currently sleeping.从接口继承的方法 org.bukkit.entity.AnimalTamer
getUniqueId
从接口继承的方法 org.bukkit.attribute.Attributable
getAttribute
从接口继承的方法 org.bukkit.command.CommandSender
sendMessage, sendMessage, sendMessage, sendMessage
从接口继承的方法 org.bukkit.entity.Damageable
damage, damage, damage, getAbsorptionAmount, getHealth, getMaxHealth, resetMaxHealth, setAbsorptionAmount, setHealth, setMaxHealth
从接口继承的方法 org.bukkit.entity.Entity
addPassenger, addScoreboardTag, copy, copy, createSnapshot, eject, getAsString, getBoundingBox, getEntityId, getFacing, getFallDistance, getFireTicks, getFreezeTicks, getHeight, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getMaxFreezeTicks, getNearbyEntities, getPassenger, getPassengers, getPistonMoveReaction, getPortalCooldown, getPose, getScoreboardTags, getServer, getSpawnCategory, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTicksLived, getTrackedBy, getType, getUniqueId, getVehicle, getVelocity, getWidth, getWorld, hasGravity, isCustomNameVisible, isDead, isEmpty, isFrozen, isGlowing, isInsideVehicle, isInvulnerable, isInWater, isInWorld, isOnGround, isPersistent, isSilent, isValid, isVisibleByDefault, isVisualFire, leaveVehicle, playEffect, remove, removePassenger, removeScoreboardTag, setCustomNameVisible, setFallDistance, setFireTicks, setFreezeTicks, setGlowing, setGravity, setInvulnerable, setLastDamageCause, setPassenger, setPersistent, setPortalCooldown, setRotation, setSilent, setTicksLived, setVelocity, setVisibleByDefault, setVisualFire, spigot, teleport, teleport, teleport, teleport
从接口继承的方法 org.bukkit.entity.LivingEntity
addPotionEffect, addPotionEffect, addPotionEffects, attack, canBreatheUnderwater, getActivePotionEffects, getArrowCooldown, getArrowsInBody, getCanPickupItems, getCategory, getCollidableExemptions, getDeathSound, getDrinkingSound, getEatingSound, getEquipment, getEyeHeight, getEyeHeight, getEyeLocation, getFallDamageSound, getFallDamageSoundBig, getFallDamageSoundSmall, getHurtSound, getItemInUse, getItemInUseTicks, getKiller, getLastDamage, getLastTwoTargetBlocks, getLeashHolder, getLineOfSight, getMaximumAir, getMaximumNoDamageTicks, getMemory, getNoActionTicks, getNoDamageTicks, getPotionEffect, getRemainingAir, getRemoveWhenFarAway, getTargetBlock, getTargetBlockExact, getTargetBlockExact, hasAI, hasLineOfSight, hasPotionEffect, isClimbing, isCollidable, isGliding, isInvisible, isLeashed, isRiptiding, isSleeping, isSwimming, playHurtAnimation, rayTraceBlocks, rayTraceBlocks, removePotionEffect, setAI, setArrowCooldown, setArrowsInBody, setCanPickupItems, setCollidable, setGliding, setInvisible, setItemInUseTicks, setLastDamage, setLeashHolder, setMaximumAir, setMaximumNoDamageTicks, setMemory, setNoActionTicks, setNoDamageTicks, setRemainingAir, setRemoveWhenFarAway, setSwimming, swingMainHand, swingOffHand
从接口继承的方法 org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
从接口继承的方法 org.bukkit.Nameable
getCustomName, setCustomName
从接口继承的方法 org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
从接口继承的方法 org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
从接口继承的方法 org.bukkit.projectiles.ProjectileSource
launchProjectile, launchProjectile
从接口继承的方法 org.bukkit.permissions.ServerOperator
isOp, setOp
-
方法详细资料
-
getName
返回该玩家的玩家名.原文:Returns the name of this player
- 指定者:
getName
在接口中AnimalTamer
- 指定者:
getName
在接口中CommandSender
- 返回:
- 玩家名
-
getInventory
获取玩家的物品栏(俗称背包).原文:Get the player's inventory.
- 指定者:
getInventory
在接口中InventoryHolder
- 返回:
- 玩家物品栏, 包含盔甲槽
-
getEnderChest
获取玩家的末影箱物品栏.原文:Get the player's EnderChest inventory
- 返回:
- 玩家的末影箱
-
getMainHand
获取玩家设置的主手.原文:Gets the player's selected main hand
- 返回:
- 玩家主手
-
setWindowProperty
若玩家当前打开了一个物品栏窗口, 此方法将设置窗口的属性, 比如酿造台的酿造进度.原文: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. The Seed is used to generate enchantment options in the enchanting table for the player.- 返回:
- 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.- 参数:
seed
- the player's new enchantment seed
-
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
@Nullable @Nullable InventoryView openWorkbench(@Nullable @Nullable Location location, boolean force) 打开一个空白工作台物品栏界面, 玩家物品栏(背包)在底部.原文:Opens an empty workbench inventory window with the player's inventory on the bottom.
- 参数:
location
- 工作台位置. 若为null, 将使用玩家所处位置force
- 若为false, 同时指定位置不是工作台方块, 将不会打开工作台物品栏, 并返回null(true就是不管怎样都向 玩家展示工作台界面)- 返回:
- 新打开的物品栏的视图, 如果不能打开返回null
-
openEnchanting
@Nullable @Nullable InventoryView openEnchanting(@Nullable @Nullable Location location, boolean force) 打开一个空白附魔台物品栏界面, 玩家物品栏(背包)在底部.原文:Opens an empty enchanting inventory window with the player's inventory on the bottom.
- 参数:
location
- 附魔台位置. 若为null, 将使用玩家所处位置force
- 若为false, 同时指定位置不是附魔台方块, 将不会打开工作台物品栏, 并返回null(true就是不管怎样都向 玩家展示附魔台界面)- 返回:
- 新打开的物品栏的视图, 如果不能打开返回null
-
openInventory
打开指定的物品栏.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
与某村民开始交易. 注意: 同一时间内只有一名玩家可以与此村民进行交易. 欲使多名玩家能同时与此村民进行交易, 请将“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
- 与哪位村民交易. 不能为nullforce
- 是否强制开始交易, 即使另一名玩家正在与此村民交易- 返回:
- 新打开的物品栏的视图, 如果不能打开返回null
-
openMerchant
与某商人开始交易. 注意: 同一时间内只有一名玩家可以与此商人进行交易. 欲使多名玩家能同时与此商人进行交易, 请将“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
- 与哪个商人交易. 不能为nullforce
- 是否强制开始交易, 即使另一名玩家正在与此商人交易- 返回:
- 新打开的物品栏的视图, 如果不能打开返回null
-
closeInventory
void closeInventory()强制关闭玩家当前打开的物品栏视图.原文:Force-closes the currently open inventory view for this player, if any.
-
getItemInHand
已过时。人类现能双持, 请使用PlayerInventory
中更明确的方法返回你手握的物品, 可能为空.原文:Returns the ItemStack currently in your hand, can be empty.
- 返回:
- 你正在握持的物品的ItemStack(物品堆)对象
-
setItemInHand
已过时。人类现能双持, 请使用PlayerInventory
中更明确的方法设置你手握的物品, 将替换你所持的任何物品.原文:Sets the item to the given ItemStack, this will replace whatever the user was holding.
- 参数:
item
- 要设置的物品堆
-
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
设置你正在拖动的物品, 将替换你所拖动的任何物品. 如果玩家没有打开任何窗口, 将永远为空(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
检查指定物品是否处于冷却状态.原文:Check whether a cooldown is active on the specified material.
- 参数:
material
- 要检查的物品种类- 返回:
- 该物品是否进入了冷却
- 抛出:
IllegalArgumentException
- 如果 material 不是物品
-
getCooldown
获取指定物品的冷却时长 (以tick为单位).原文:Get the cooldown time in ticks remaining for the specified material.
- 参数:
material
- 要检查的物品种类- 返回:
- 剩余冷却时长 (以tick为单位)
- 抛出:
IllegalArgumentException
- 如果 material 不是物品
-
setCooldown
设置指定物品的冷却时长. 设为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 不是物品
-
getSleepTicks
int getSleepTicks()获取玩家的睡眠时间 (以tick为单位), 该值可能有上限.原文:Get the sleep ticks of the player. This value may be capped.
- 返回:
- 玩家睡了多久
-
sleep
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.- 参数:
location
- the location of the bedforce
- whether to try and sleep at the location even if not normally possible- 返回:
- whether the sleep was successful
-
wakeup
void wakeup(boolean setSpawnLocation) Causes the player to wakeup if they are currently sleeping.- 参数:
setSpawnLocation
- whether to set their spawn location to the bed they are currently sleeping in- 抛出:
IllegalStateException
- if not sleeping
-
getBedLocation
Gets the location of the bed the player is currently sleeping in- 返回:
- location
- 抛出:
IllegalStateException
- if not sleeping
-
getGameMode
- 返回:
- 游戏模式
-
setGameMode
- 参数:
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. This is used to calculate damage, with 1.0 representing a fully charged attack and 0.0 representing a non-charged attack- 返回:
- A float between 0.0-1.0 representing the progress of the charge
-
discoverRecipe
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
- the key of the recipe to discover- 返回:
- whether or not the recipe was newly discovered
-
discoverRecipes
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
- the keys of the recipes to discover- 返回:
- 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
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
- the key of the recipe to undiscover- 返回:
- whether or not the recipe was successfully undiscovered (i.e. it was previously discovered)
-
undiscoverRecipes
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
- the keys of the recipes to undiscover- 返回:
- 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
Check whether or not this entity has discovered the specified recipe.- 参数:
recipe
- the key of the recipe to check- 返回:
- true if discovered, false otherwise
-
getDiscoveredRecipes
Get an immutable set of recipes this entity has discovered.- 返回:
- all discovered recipes
-
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
已过时。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 renderParrot
entities.- 参数:
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
已过时。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 renderParrot
entities.- 参数:
entity
- 坐在玩家右肩的实体
-
dropItem
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 entireItemStack
or just 1 of the items.- 参数:
dropAll
- True to drop entire stack, false to drop 1 of the stack- 返回:
- True if item was dropped successfully
-
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()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.- 返回:
- 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.- 参数:
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.- 返回:
- 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.- 参数:
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.- 返回:
- the starvation rate
-
setStarvationRate
void setStarvationRate(int ticks) Get the starvation rate (1 health per x ticks) of the HumanEntity. Default is 80.- 参数:
ticks
- the amount of ticks to lose 1 health
-
getLastDeathLocation
Gets the player's last death location.- 返回:
- the last death location if it exists, otherwise null.
-
setLastDeathLocation
Sets the player's last death location.
Note: This data is updated in the player's client only when the player respawns.- 参数:
location
- where to set the last death player location
-
fireworkBoost
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 suppliedfireworkItemStack
must be a firework rocket. The power of the boost will directly correlate toFireworkMeta.getPower()
.- 参数:
fireworkItemStack
- the firework item stack to use to glide- 返回:
- the attached
Firework
, or null if the entity could not be boosted - 抛出:
IllegalArgumentException
- if the fireworkItemStack is not a firework
-
PlayerInventory
中更明确的方法