接口 Entity
- 所有已知子接口:
AbstractArrow,AbstractCow,AbstractCubeMob,AbstractHorse,AbstractNautilus,AbstractSkeleton,AbstractVillager,AbstractWindCharge,AcaciaBoat,AcaciaChestBoat,Ageable,Allay,Ambient,Animals,AreaEffectCloud,Armadillo,ArmorStand,Arrow,Axolotl,BambooChestRaft,BambooRaft,Bat,Bee,BirchBoat,BirchChestBoat,Blaze,BlockDisplay,Boat,Bogged,Boss,Breedable,Breeze,BreezeWindCharge,Camel,CamelHusk,Cat,CaveSpider,CherryBoat,CherryChestBoat,ChestBoat,ChestedHorse,Chicken,Cod,CommandMinecart,ComplexEntityPart,ComplexLivingEntity,CopperGolem,Cow,Creaking,Creature,Creeper,Cushion,Damageable,DarkOakBoat,DarkOakChestBoat,Display,Dolphin,Donkey,DragonFireball,Drowned,Egg,ElderGuardian,EnderCrystal,EnderDragon,EnderDragonPart,Enderman,Endermite,EnderPearl,EnderSignal,Enemy,Evoker,EvokerFangs,ExperienceOrb,Explosive,ExplosiveMinecart,FallingBlock,Fireball,Firework,Fish,FishHook,Flying,Fox,Frog,Ghast,Giant,GlowItemFrame,GlowSquid,Goat,Golem,Guardian,Hanging,HappyGhast,Hoglin,HopperMinecart,Horse,HumanEntity,Husk,Illager,Illusioner,Interaction,IronGolem,Item,ItemDisplay,ItemFrame,JungleBoat,JungleChestBoat,LargeFireball,LeashHitch,LightningStrike,LingeringPotion,LivingEntity,Llama,LlamaSpit,MagmaCube,MangroveBoat,MangroveChestBoat,Mannequin,Marker,Minecart,Mob,Monster,Mule,MushroomCow,Nautilus,NPC,OakBoat,OakChestBoat,Ocelot,OminousItemSpawner,Painting,PaleOakBoat,PaleOakChestBoat,Panda,Parched,Parrot,Phantom,Pig,Piglin,PiglinAbstract,PiglinBrute,PigZombie,Pillager,Player,PolarBear,PoplarBoat,PoplarChestBoat,PoweredMinecart,Projectile,PufferFish,Rabbit,Raider,Ravager,RideableMinecart,Salmon,Sheep,Shulker,ShulkerBullet,Silverfish,SizedFireball,Skeleton,SkeletonHorse,Slime,SmallFireball,Sniffer,Snowball,Snowman,SpawnerMinecart,SpectralArrow,Spellcaster,Spider,SplashPotion,SpruceBoat,SpruceChestBoat,Squid,Steerable,StorageMinecart,Stray,Strider,SulfurCube,Tadpole,Tameable,TextDisplay,ThrowableProjectile,ThrownExpBottle,ThrownPotion,TippedArrow,TNTPrimed,TraderLlama,Trident,TropicalFish,Turtle,Vehicle,Vex,Villager,Vindicator,WanderingTrader,Warden,WaterMob,WindCharge,Witch,Wither,WitherSkeleton,WitherSkull,Wolf,Zoglin,Zombie,ZombieHorse,ZombieNautilus,ZombieVillager
当 isInWorld() 返回 false 时, 不保证所有方法都可用/或者有副作用.
原文: Represents a base entity in the world
Not all methods are guaranteed to work/may have side effects when
isInWorld() is false.
-
嵌套类概要
嵌套类 -
方法概要
修饰符和类型方法说明booleanaddPassenger(@NotNull Entity passenger) 添加一名乘客.boolean为此实体添加一个标签.copy()创建此实体及其所有数据的副本.创建此实体及其所有数据的副本.创建一个表示此实体当前状态的EntitySnapshot.booleaneject()弹出所有乘客.获取此实体的 NBT 字符串.获取实体当前的边界框.int返回此实体的唯一ID获取实体当前朝向的最接近的基本BlockFace方向.float返回此实体已下落的距离.int返回实体当前着火的tick (还有多久停止着火)int返回实体当前的冰冻刻 (实体处于细雪中的刻数).double获取实体高度获取此实体上的最后一个EntityDamageEvent.获取实体当前位置getLocation(@Nullable Location loc) 将实体的当前位置存储到提供的Location中.int返回实体的最大着火刻int返回实体的最大冰冻刻 (完全冰冻所需的刻数).getNearbyEntities(double x, double y, double z) 返回以此实体为中心的边界框内的所有实体.已过时。实体可能有多名乘客.获取载具的乘客列表.返回实体被活塞移动时的反应.int获取此实体能再次使用传送门前需要等待的时间 (以刻为单位).getPose()获取实体当前的姿势.返回实体标签集合.返回包含此实体的服务器获取此实体所属的生成类别.获取此实体高速溅入水中时发出的Sound.获取此实体游泳时发出的Sound.获取此实体溅入水中时发出的Sound.int获取此实体生存时间刻.获取当前正在追踪此实体的所有玩家.getType()获取实体类型返回实体的UUID (唯一且持久的id)获取实体所在的载具, 若没有则返回null.获取此实体的速度.doublegetWidth()获取实体宽度getWorld()获取实体当前所在的世界boolean返回重力是否适用于此实体.boolean获取是否在客户端上显示实体的自定义名称.booleanisDead()返回此实体是否已被标记为删除.booleanisEmpty()检查是否有乘客.booleanisFrozen()获取实体是否已完全冰冻 (在细雪中待满了最大冰冻刻).boolean获取实体是否发光.boolean返回此实体是否在载具内.boolean获取实体是否无敌.boolean返回实体是否在水中.boolean检查此实体是否已生成在世界中.boolean返回实体是否站在地面上.boolean返回实体是否会被持久化.booleanisSilent()获取实体是否保持安静.booleanisValid()如果此实体已经死亡、因为其他原因被抹去或尚未添加到世界, 则返回false.boolean获取此实体是否默认可见.boolean获取实体是否有视觉上的火焰效果 (实体将始终显示为着火状态).boolean离开当前的载具.voidplayEffect(@NotNull EntityEffect type) 为此实体执行指定的EntityEffect.voidremove()将实体标记为删除.booleanremovePassenger(@NotNull Entity passenger) 移除一名乘客.boolean删除此实体的一个标签.voidsetCustomNameVisible(boolean flag) 设置是否在客户端上显示实体的自定义名称.voidsetFallDistance(float distance) 设置此实体已下落的距离.voidsetFireTicks(int ticks) 设置实体当前着火的tick (还有多久停止着火)voidsetFreezeTicks(int ticks) 设置实体当前的冰冻刻 (实体处于细雪中的刻数).voidsetGlowing(boolean flag) 设置实体是否有团队颜色(默认白色)的发光.voidsetGravity(boolean gravity) 设置重力是否适用于此实体.voidsetInvulnerable(boolean flag) 设置实体是否无敌.void已过时, 待删除: 此 API 元素将从以后的版本中删除。此方法仅供内部使用, 将被移除booleansetPassenger(@NotNull Entity passenger) 已过时。实体可能有多名乘客.voidsetPersistent(boolean persistent) 设置实体是否会被持久化.voidsetPortalCooldown(int cooldown) 设置此实体使用传送门前需要等待的时间 (以刻为单位).voidsetRotation(float yaw, float pitch) 设置实体的旋转角度.voidsetSilent(boolean flag) 获取实体是否保持安静.voidsetTicksLived(int value) 设置此实体生存时间刻.voidsetVelocity(@NotNull Vector velocity) 设置此实体的速度 (单位: 米每tick).voidsetVisibleByDefault(boolean visible) 设置此实体是否默认可见.voidsetVisualFire(boolean fire) 设置实体是否有视觉上的火焰效果 (实体将始终显示为着火状态).spigot()boolean将此实体传送到目标实体.booleanteleport(@NotNull Entity destination, @NotNull PlayerTeleportEvent.TeleportCause cause) 将此实体传送到目标实体.boolean将此实体传送到给定位置.booleanteleport(@NotNull Location location, @NotNull PlayerTeleportEvent.TeleportCause cause) 将此实体传送到给定位置.从接口继承的方法 org.bukkit.command.CommandSender
getName, sendMessage, sendMessage, sendMessage, sendMessage从接口继承的方法 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.permissions.ServerOperator
isOp, setOp
-
方法详细资料
-
getLocation
获取实体当前位置原文: Gets the entity's current position
- 返回:
- 一个新的 Location, 包含此实体的位置
-
getLocation
@Contract("null -> null; !null -> !null") @Nullable @Nullable Location getLocation(@Nullable @Nullable Location loc) 将实体的当前位置存储到提供的Location中.
如果提供的Location为null,则此方法不会执行任何操作并返回null.原文: Stores the entity's current position in the provided Location object.
If the provided Location is null this method does nothing and returns null.
- 参数:
loc- 要复制到的Location实例- 返回:
- 提供的Location或null
-
setVelocity
设置此实体的速度 (单位: 米每tick).原文: Sets this entity's velocity
- 参数:
velocity- 新的行进速度(向量)
-
getVelocity
获取此实体的速度.原文: Gets this entity's current velocity
- 返回:
- 实体当前行进速度(向量)
-
getHeight
double getHeight()获取实体高度原文: Gets the entity's height
- 返回:
- 实体高度
-
getWidth
double getWidth()获取实体宽度原文: Gets the entity's width
- 返回:
- 实体宽度
-
getBoundingBox
获取实体当前的边界框.返回的边界框反映了实体的当前位置和大小.
原文: Gets the entity's current bounding box.
The returned bounding box reflects the entity's current location and size.
- 返回:
- 实体当前的边界框
-
isOnGround
boolean isOnGround()返回实体是否站在地面上.
此值状态由服务器更新, 除非实体移动,否则不会重新计算.原文: Returns true if the entity is supported by a block. This value is a state updated by the server and is not recalculated unless the entity moves.
- 返回:
- 实体是否站在地上
- 另请参阅:
-
isInWater
boolean isInWater()返回实体是否在水中.原文: Returns true if the entity is in water.
- 返回:
- 实体是否在水中
-
getWorld
获取实体当前所在的世界原文: Gets the current world this entity resides in
- 返回:
- 世界
-
setRotation
void setRotation(float yaw, float pitch) 设置实体的旋转角度.注意: 如果实体受 AI 影响, AI 可能会覆盖此旋转.
原文: Sets the entity's rotation.
Note that if the entity is affected by AI, it may override this rotation.
- 参数:
yaw- 偏航角pitch- 俯仰角- 抛出:
UnsupportedOperationException- 如果用于玩家
-
teleport
将此实体传送到给定位置.
如果该实体乘坐载具, 则在传送之前卸下载具.原文: Teleports this entity to the given location. If this entity is riding a vehicle, it will be dismounted prior to teleportation.
- 参数:
location- 此实体要传送到的新位置- 返回:
- 是否传送成功
-
teleport
boolean teleport(@NotNull @NotNull Location location, @NotNull @NotNull PlayerTeleportEvent.TeleportCause cause) 将此实体传送到给定位置.
如果该实体乘坐载具, 则在传送之前卸下载具.原文: Teleports this entity to the given location. If this entity is riding a vehicle, it will be dismounted prior to teleportation.
- 参数:
location- 此实体要传送到的新位置cause- 传送原因- 返回:
- 是否传送成功
-
teleport
将此实体传送到目标实体.
如果该实体乘坐载具, 则在传送之前离开载具.原文: Teleports this entity to the target Entity. If this entity is riding a vehicle, it will be dismounted prior to teleportation.
- 参数:
destination- 目标实体- 返回:
- 是否传送成功
-
teleport
boolean teleport(@NotNull @NotNull Entity destination, @NotNull @NotNull PlayerTeleportEvent.TeleportCause cause) 将此实体传送到目标实体.
如果该实体乘坐载具, 则在传送之前离开载具.原文: Teleports this entity to the given location. If this entity is riding a vehicle, it will be dismounted prior to teleportation.
- 参数:
destination- 目标实体cause- 传送原因- 返回:
- 是否传送成功
-
getNearbyEntities
返回以此实体为中心的边界框内的所有实体.原文: Returns a list of entities within a bounding box centered around this entity
- 参数:
x- 边界框X轴半径y- 边界框Y轴半径z- 边界框Z轴半径- 返回:
List<Entity>附近的实体列表
-
getEntityId
int getEntityId()返回此实体的唯一ID原文: Returns a unique id for this entity
- 返回:
- 实体ID
-
getFireTicks
int getFireTicks()返回实体当前着火的tick (还有多久停止着火)原文: Returns the entity's current fire ticks (ticks before the entity stops being on fire).
- 返回:
- 着火刻的数值
-
getMaxFireTicks
int getMaxFireTicks()返回实体的最大着火刻原文: Returns the entity's maximum fire ticks.
- 返回:
- 最大着火刻的数值
-
setFireTicks
void setFireTicks(int ticks) 设置实体当前着火的tick (还有多久停止着火)原文: Sets the entity's current fire ticks (ticks before the entity stops being on fire).
- 参数:
ticks- 剩余的刻数
-
setVisualFire
void setVisualFire(boolean fire) 设置实体是否有视觉上的火焰效果 (实体将始终显示为着火状态).原文: Sets if the entity has visual fire (it will always appear to be on fire).
- 参数:
fire- 是否启用视觉火焰
-
isVisualFire
boolean isVisualFire()获取实体是否有视觉上的火焰效果 (实体将始终显示为着火状态).原文: Gets if the entity has visual fire (it will always appear to be on fire).
- 返回:
- 是否启用了视觉火焰
-
getFreezeTicks
int getFreezeTicks()返回实体当前的冰冻刻 (实体处于细雪中的刻数).原文: Returns the entity's current freeze ticks (amount of ticks the entity has been in powdered snow).
- 返回:
- 冰冻刻数值
-
getMaxFreezeTicks
int getMaxFreezeTicks()返回实体的最大冰冻刻 (完全冰冻所需的刻数).原文: Returns the entity's maximum freeze ticks (amount of ticks before it will be fully frozen)
- 返回:
- 最大冰冻刻数值
-
setFreezeTicks
void setFreezeTicks(int ticks) 设置实体当前的冰冻刻 (实体处于细雪中的刻数).原文: Sets the entity's current freeze ticks (amount of ticks the entity has been in powdered snow).
- 参数:
ticks- 当前刻数
-
isFrozen
boolean isFrozen()获取实体是否已完全冰冻 (在细雪中待满了最大冰冻刻).原文: Gets if the entity is fully frozen (it has been in powdered snow for max freeze ticks).
- 返回:
- 冰冻状态
-
remove
void remove()将实体标记为删除.原文: Mark the entity's removal.
- 抛出:
UnsupportedOperationException- 如果你试图移除一名玩家. 对于此场景请使用Player.kickPlayer(String)
-
isDead
boolean isDead()返回此实体是否已被标记为删除.原文: Returns true if this entity has been marked for removal.
- 返回:
- 实体是否死亡
-
isValid
boolean isValid()如果此实体已经死亡、因为其他原因被抹去或尚未添加到世界, 则返回false.原文: Returns false if the entity has died, been despawned for some other reason, or has not been added to the world.
- 返回:
- 实体是否有效.
-
getServer
返回包含此实体的服务器原文: Gets the
Serverthat contains this Entity- 指定者:
getServer在接口中CommandSender- 返回:
- 运行此实体的服务器
-
isPersistent
boolean isPersistent()返回实体是否会被持久化.默认情况下所有实体都是持久化的. 如果实体骑乘的载具不是持久化的, 则该实体也不会被持久化.
玩家的持久化标志控制在玩家退出时是否保存其玩家数据文件. 如果玩家直接或间接骑乘非持久化实体, 则根级载具及其所有乘客都不会被持久化.
注意: 不要与
LivingEntity.setRemoveWhenFarAway(boolean)混淆, 后者控制生物实体的消失.原文: Returns true if the entity gets persisted.
By default all entities are persistent. An entity will also not get persisted, if it is riding an entity that is not persistent.
The persistent flag on players controls whether or not to save their playerdata file when they quit. If a player is directly or indirectly riding a non-persistent entity, the vehicle at the root and all its passengers won't get persisted.
This should not be confused with
LivingEntity.setRemoveWhenFarAway(boolean)which controls despawning of living entities.- 返回:
- 实体是否持久化
-
setPersistent
void setPersistent(boolean persistent) 设置实体是否会被持久化.原文: Sets whether or not the entity gets persisted.
- 参数:
persistent- 持久化状态- 另请参阅:
-
getPassenger
已过时。实体可能有多名乘客. 请使用getPassengers()获取乘坐载具的主要乘客.
可能会有多个乘客, 这个方法只返回主要乘客.原文:Gets the primary passenger of a vehicle. For vehicles that could have multiple passengers, this will only return the primary passenger.
- 返回:
- 一个实体
-
setPassenger
已过时。实体可能有多名乘客. 请使用addPassenger(org.bukkit.entity.Entity)设置乘坐载具的主要乘客.原文: Set the passenger of a vehicle.
- 参数:
passenger- 新乘客- 返回:
- 如果因为某种原因不能设置, 则返回false
-
getPassengers
获取载具的乘客列表.
对返回列表的操作不会反映到实体的当前乘客列表上, 也不保证返回列表的可变性.原文: Gets a list of passengers of this vehicle.
The returned list will not be directly linked to the entity's current passengers, and no guarantees are made as to its mutability.
- 返回:
- 与当前乘客相对应的实体列表.
-
addPassenger
添加一名乘客.原文: Add a passenger to the vehicle.
- 参数:
passenger- 要添加的乘客- 返回:
- 如果因为某种原因不能添加, 则返回false
-
removePassenger
移除一名乘客.原文: Remove a passenger from the vehicle.
- 参数:
passenger- 要移除的乘客- 返回:
- 如果因为某种原因不能删除, 则返回false
-
isEmpty
boolean isEmpty()检查是否有乘客.原文: Check if a vehicle has passengers.
- 返回:
- 载具是否为空.
-
eject
boolean eject()弹出所有乘客.原文: Eject any passenger.
- 返回:
- 是否有乘客被弹出.
-
getFallDistance
float getFallDistance()返回此实体已下落的距离.原文: Returns the distance this entity has fallen
- 返回:
- 距离.
-
setFallDistance
void setFallDistance(float distance) 设置此实体已下落的距离.原文: Sets the fall distance for this entity
- 参数:
distance- 新距离.
-
setLastDamageCause
@Deprecated(since="1.20.4", forRemoval=true) void setLastDamageCause(@Nullable @Nullable EntityDamageEvent event) 已过时, 待删除: 此 API 元素将从以后的版本中删除。此方法仅供内部使用, 将被移除记录此实体上的最后一个EntityDamageEvent.原文: Record the last
EntityDamageEventinflicted on this entity- 参数:
event- 一个EntityDamageEvent
-
getLastDamageCause
获取此实体上的最后一个EntityDamageEvent.原文: Retrieve the last
EntityDamageEventinflicted on this entity. This event may have been cancelled.- 返回:
- 最后一个已知的
EntityDamageEvent, 如果迄今为止没有受到伤害, 则为null
-
getUniqueId
返回实体的UUID (唯一且持久的id)原文: Returns a unique and persistent id for this entity
- 返回:
- UUID
-
getTicksLived
int getTicksLived()获取此实体生存时间刻.
这相当于实体的"年龄".原文: Gets the amount of ticks this entity has lived for.
This is the equivalent to "age" in entities.
- 返回:
- 实体年龄
-
setTicksLived
void setTicksLived(int value) 设置此实体生存时间刻.
这相当于实体中的"年龄". 不得少于一个tick.原文: Sets the amount of ticks this entity has lived for.
This is the equivalent to "age" in entities. May not be less than one tick.
- 参数:
value- 实体年龄
-
playEffect
为此实体执行指定的EntityEffect.
这将对实体附近的所有玩家都是可见的.
如果效果不适用于此类实体,则不会播放.原文: Performs the specified
EntityEffectfor this entity.This will be viewable to all players near the entity.
If the effect is not applicable to this class of entity, it will not play.
- 参数:
type- 播放效果.
-
getType
获取实体类型原文: Get the type of the entity.
- 返回:
- 实体类型.
-
getSwimSound
- 返回:
- 游泳声音
-
getSwimSplashSound
获取此实体溅入水中时发出的Sound. 对于大多数实体, 这只是Sound.ENTITY_GENERIC_SPLASH.原文: Get the
Soundthis entity makes when splashing in water. For most entities, this is justSound.ENTITY_GENERIC_SPLASH.- 返回:
- 溅水声
-
getSwimHighSpeedSplashSound
获取此实体高速溅入水中时发出的Sound. 对于大多数实体, 这只是Sound.ENTITY_GENERIC_SPLASH.原文: Get the
Soundthis entity makes when splashing in water at high speeds. For most entities, this is justSound.ENTITY_GENERIC_SPLASH.- 返回:
- 溅水声
-
isInsideVehicle
boolean isInsideVehicle()返回此实体是否在载具内.原文: Returns whether this entity is inside a vehicle.
- 返回:
- 此实体是否在载具内.
-
leaveVehicle
boolean leaveVehicle()离开当前的载具. 如果实体当前在载具中(并从中移除), 则返回true, 否则将返回false.原文: Leave the current vehicle. If the entity is currently in a vehicle (and is removed from it), true will be returned, otherwise false will be returned.
- 返回:
- 是否成功离开.
-
getVehicle
获取实体所在的载具, 若没有则返回null.原文: Get the vehicle that this entity is inside. If there is no vehicle, null will be returned.
- 返回:
- 当前载具
-
setCustomNameVisible
void setCustomNameVisible(boolean flag) 设置是否在客户端上显示实体的自定义名称. 名称将会像玩家一样显示在实体上方.
这个值对玩家无效, 玩家会一直显示.原文: Sets whether or not to display the mob's custom name client side. The name will be displayed above the mob similarly to a player.
This value has no effect on players, they will always display their name.
- 参数:
flag- 是否显示自定义名称
-
isCustomNameVisible
boolean isCustomNameVisible()获取是否在客户端上显示实体的自定义名称. 名称将会像玩家一样显示在实体上方.
这个值对玩家无效, 玩家会一直显示.原文: Gets whether or not the mob's custom name is displayed client side.
This value has no effect on players, they will always display their name.
- 返回:
- 是否显示自定义名称
-
setVisibleByDefault
void setVisibleByDefault(boolean visible) 设置此实体是否默认可见.如果此实体默认不可见, 则需要调用
Player.showEntity(org.bukkit.plugin.Plugin, org.bukkit.entity.Entity)才能使指定玩家看到该实体.原文: Sets whether or not this entity is visible by default. If this entity is not visible by default, then
Player.showEntity(org.bukkit.plugin.Plugin, org.bukkit.entity.Entity)will need to be called before the entity is visible to a given player.- 参数:
visible- 默认可见性状态
-
isVisibleByDefault
boolean isVisibleByDefault()获取此实体是否默认可见.如果此实体默认不可见, 则需要调用
Player.showEntity(org.bukkit.plugin.Plugin, org.bukkit.entity.Entity)才能使指定玩家看到该实体.原文: Gets whether or not this entity is visible by default. If this entity is not visible by default, then
Player.showEntity(org.bukkit.plugin.Plugin, org.bukkit.entity.Entity)will need to be called before the entity is visible to a given player.- 返回:
- 默认可见性状态
-
getTrackedBy
获取当前正在追踪此实体的所有玩家."追踪"意味着此实体已被发送给玩家, 且玩家正在接收其状态更新. 注意: 客户端的
'实体距离'设置不会影响实体被追踪的范围.原文: Get all players that are currently tracking this entity.
'Tracking' means that this entity has been sent to the player and that they are receiving updates on its state. Note that the client's
'Entity Distance'setting does not affect the range at which entities are tracked.- 返回:
- 正在追踪此实体的玩家集合, 若无则为空集合
-
setGlowing
void setGlowing(boolean flag) 设置实体是否有团队颜色(默认白色)的发光. 注意:本方法用到了实体的'Glowing'属性, 不是给实体应用发光药水效果.原文: Sets whether the entity has a team colored (default: white) glow. nb: this refers to the 'Glowing' entity property, not whether a glowing potion effect is applied
- 参数:
flag- 是否发光
-
isGlowing
boolean isGlowing()获取实体是否发光. 注意:本方法用到了实体的'Glowing'属性, 不是给实体应用发光药水效果.原文: nb: this refers to the 'Glowing' entity property, not whether a glowing potion effect is applied
- 返回:
- 是否发光
-
setInvulnerable
void setInvulnerable(boolean flag) 设置实体是否无敌.
当一个实体无敌时, 它只能被创造性模式中的玩家攻击.原文: Sets whether the entity is invulnerable or not.
When an entity is invulnerable it can only be damaged by players in creative mode.
- 参数:
flag- 是否无敌
-
isInvulnerable
boolean isInvulnerable()获取实体是否无敌.原文: Gets whether the entity is invulnerable or not.
- 返回:
- 是否无敌
-
isSilent
boolean isSilent()获取实体是否保持安静.原文: Gets whether the entity is silent or not.
- 返回:
- 实体是否保持安静
-
setSilent
void setSilent(boolean flag) 获取实体是否保持安静.
当实体静默时, 它不会发出任何声音.原文: Sets whether the entity is silent or not.
When an entity is silent it will not produce any sound.
- 参数:
flag- 实体是否保持安静
-
hasGravity
boolean hasGravity()返回重力是否适用于此实体.原文: Returns whether gravity applies to this entity.
- 返回:
- 重力是否适用于此实体
-
setGravity
void setGravity(boolean gravity) 设置重力是否适用于此实体.原文: Sets whether gravity applies to this entity.
- 参数:
gravity- 重力是否适用于此实体
-
getPortalCooldown
int getPortalCooldown()获取此实体能再次使用传送门前需要等待的时间 (以刻为单位).原文: Gets the period of time (in ticks) before this entity can use a portal.
- 返回:
- portal cooldown ticks
-
setPortalCooldown
void setPortalCooldown(int cooldown) 设置此实体使用传送门前需要等待的时间 (以刻为单位).原文: Sets the period of time (in ticks) before this entity can use a portal.
- 参数:
cooldown- 传送门冷却刻数
-
getScoreboardTags
返回实体标签集合.
实体的标签数不得超过1024个.原文: Returns a set of tags for this entity.
Entities can have no more than 1024 tags.- 返回:
- 此实体的标签集合
-
addScoreboardTag
为此实体添加一个标签.
实体的标签数不得超过1024个.原文: Add a tag to this entity.
Entities can have no more than 1024 tags.- 参数:
tag- 要添加的标签- 返回:
- 是否成功添加
-
removeScoreboardTag
删除此实体的一个标签.
实体的标签数不得超过1024个.原文: Removes a given tag from this entity.
- 参数:
tag- 要删除的标签- 返回:
- 是否成功删除
-
getPistonMoveReaction
返回实体被活塞移动时的反应.原文: Returns the reaction of the entity when moved by a piston.
- 返回:
- 反应
-
getFacing
获取实体当前朝向的最接近的基本BlockFace方向.
不会返回任何非基本方向, 如BlockFace.UP或BlockFace.DOWN.
Hanging实体会覆盖此调用, 因此其行为可能不同.原文: Get the closest cardinal
BlockFacedirection an entity is currently facing.
This will not return any non-cardinal directions such asBlockFace.UPorBlockFace.DOWN.
Hangingentities will override this call and thus their behavior may be different.- 返回:
- 实体当前的基本朝向
- 另请参阅:
-
getPose
获取实体当前的姿势.注意: 姿势仅在 tick 结束时更新, 因此可能与其他方法不一致. 例如
Player.isSneaking()返回 true 并不意味着当前姿势为Pose.SNEAKING.原文: Gets the entity's current pose. Note that the pose is only updated at the end of a tick, so may be inconsistent with other methods. eg
Player.isSneaking()being true does not imply the current pose will bePose.SNEAKING- 返回:
- 当前姿势
-
getSpawnCategory
获取此实体所属的生成类别.原文: Get the category of spawn to which this entity belongs.
- 返回:
- 实体的生成类别
-
isInWorld
boolean isInWorld()检查此实体是否已生成在世界中.
未在世界中生成的实体不会被 tick 更新, 不会发送给玩家, 也不会保存到服务器文件中.原文: Checks if this entity has been spawned in a world.
Entities not spawned in a world will not tick, be sent to players, or be saved to the server files.- 返回:
- 实体是否已生成在世界中
-
getAsString
获取此实体的 NBT 字符串.不应将此字符串作为可序列化的值使用.
原文: Get this entity as an NBT string.
This string should not be relied upon as a serializable value.
- 返回:
- NBT 字符串, 若无法生成则返回 null
-
createSnapshot
创建一个表示此实体当前状态的EntitySnapshot.原文: Crates an
EntitySnapshotrepresenting the current state of this entity.- 返回:
- 表示此实体的快照, 若无法创建则返回 null
-
copy
创建此实体及其所有数据的副本. 不会在世界中生成该副本.
注意: 玩家无法被复制.原文: Creates a copy of this entity and all its data. Does not spawn the copy in the world.
Note: Players cannot be copied.- 返回:
- 此实体的副本
-
copy
创建此实体及其所有数据的副本. 在给定位置生成该副本.
注意: 玩家无法被复制.原文: Creates a copy of this entity and all its data. Spawns the copy at the given location.
Note: Players cannot be copied.- 参数:
to- 要复制到的位置- 返回:
- 此实体的副本
-
spigot
- 指定者:
spigot在接口中CommandSender
-