entity
Entity API中的第一个参数(int)均为Entity ID
get_max_health
entity.get_max_health(int entityId) : float
set_width
entity.set_width(int entityID, float width)
in_range
entity.in_range(int entityID, double range) : boolean
set_health
entity.set_health(int entityID, float health)
rotation_to
entity.rotation_to(int entityID) : Rotation
get_health
entity.get_health(int entityID) : float
hurt_time
entity.hurt_time(int entityID) : int
is_dead_no_hp
entity.is_dead_no_hp(int entityID) : boolean
is_dead
entity.is_dead(int entityID) : boolean
is_living_base
entity.is_living_base(int entityID) : boolean
EntityLivingBase
is_living
entity.is_living(int entityID) : boolean
EntityLiving
is_animal
entity.is_animal(int entityID) : boolean
is_mob
entity.is_mob(int entityID) : boolean
is_player
entity.is_player(int entityID) : boolean
is_self
entity.is_self(int entityID) : boolean
get_position
entity.get_position(int entityID) : BlockPos
get_x
entity.get_x(int entityID) : double
get_y
entity.get_y(int entityID) : double
get_z
entity.get_z(int entityID) : double
get_bounding_box
entity.get_bounding_box(int entityID) : AxisAlignedBoundingBox
获取实体碰撞箱,返回AxisAlignedBoundingBox
absorption
entity.absorption(int entityID) : int
inventory
entity.inventory(int entityId) : ItemTable
get_rotation
entity.get_rotation(int entityId) : Rotation
is_burning
entity.is_burning(int entityId) : boolean
is_riding
entity.is_riding(int entityId) : boolean
is_sneaking
entity.is_sneaking(int entityId) : boolean
is_sprinting
entity.is_sprinting(int entityId) : boolean
is_blocking
entity.is_blocking(int entityId) : boolean
is_bot
entity.is_bot(int entityId) : boolean
is_team
entity.is_team(int entityId) : boolean
is_team
entity.is_team(int entityId) : boolean
is_user
entity.is_user(int entityId) : boolean
is_friend
entity.is_friend(int entityId) : boolean
prev_position
entity.prev_position(int entityId) : BlockPos
remove
entity.remove(int entityId)
network
entity.network(int entityId) : NetworkPlayer
示例返回:
NetworkPlayer{ping=287, name=Darrin900, game_mode=survival}
display_name
entity.display_name(int entityId) : string
effects
entity.effects(int entityId) : PotionEffect[]
返回一个实体现有的所有药水效果,以PotionEffect形式返回
示例:
function on_enable()
local list = entity.effects()
for i = 1, #list do
local effect = list[i]
client.print(effect);
end
end
将会输出
PotionEffect{name=potion.moveSpeed, id=1, duration=1769, level=1}