跳转至

Entity

文档版本:1.21.0.24

Entity类。script_api.minecraft/server.entity.description

属性

dimension
read-only dimension: Dimension;
id
read-only id: string;
location
read-only location: Vector3;
nameTag
nameTag: string;
nameTagstring
script_api.minecraft/server.entity.nametag.description
scoreboardIdentity
read-only scoreboardIdentity: ScoreboardIdentity | undefined;
typeId
read-only typeId: string;
typeIdstring
script_api.minecraft/server.entity.typeid.description

方法

addEffect

script_api.minecraft/server.entity.addeffect.description

addEffect(effectType: EffectType | string, duration: int32, options?: EntityEffectOptions): void
addTag

script_api.minecraft/server.entity.addtag.description

addTag(tag: string): boolean
tagstring
script_api.minecraft/server.entity.addtag.tag.description
返回值:boolean
script_api.minecraft/server.entity.addtag.return
applyDamage

script_api.minecraft/server.entity.applydamage.description

applyDamage(amount: float, options?: EntityApplyDamageByProjectileOptions | EntityApplyDamageOptions): boolean
applyImpulse

script_api.minecraft/server.entity.applyimpulse.description

applyImpulse(vector: Vector3): void
applyKnockback

script_api.minecraft/server.entity.applyknockback.description

applyKnockback(directionX: float, directionZ: float, horizontalStrength: float, verticalStrength: float): void
clearVelocity

script_api.minecraft/server.entity.clearvelocity.description

clearVelocity(): void
返回值:void
script_api.minecraft/server.entity.clearvelocity.return
getBlockFromViewDirection

script_api.minecraft/server.entity.getblockfromviewdirection.description

getBlockFromViewDirection(options?: BlockRaycastOptions): BlockRaycastHit | undefined
getComponent

script_api.minecraft/server.entity.getcomponent.description

getComponent(componentId: string): EntityComponent | undefined
getComponents

script_api.minecraft/server.entity.getcomponents.description

getComponents(): EntityComponent[]
getEffect

script_api.minecraft/server.entity.geteffect.description

getEffect(effectType: EffectType | string): Effect | undefined
getEffects

script_api.minecraft/server.entity.geteffects.description

getEffects(): Effect[]
getEntitiesFromViewDirection

script_api.minecraft/server.entity.getentitiesfromviewdirection.description

getEntitiesFromViewDirection(options?: EntityRaycastOptions): EntityRaycastHit[]
getHeadLocation

script_api.minecraft/server.entity.getheadlocation.description

getHeadLocation(): Vector3
getTags

script_api.minecraft/server.entity.gettags.description

getTags(): string[]
返回值:string[]
script_api.minecraft/server.entity.gettags.return
getVelocity

script_api.minecraft/server.entity.getvelocity.description

getVelocity(): Vector3
getViewDirection

script_api.minecraft/server.entity.getviewdirection.description

getViewDirection(): Vector3
hasComponent

script_api.minecraft/server.entity.hascomponent.description

hasComponent(componentId: string): boolean
hasTag

script_api.minecraft/server.entity.hastag.description

hasTag(tag: string): boolean
tagstring
script_api.minecraft/server.entity.hastag.tag.description
返回值:boolean
script_api.minecraft/server.entity.hastag.return
isValid

script_api.minecraft/server.entity.isvalid.description

isValid(): boolean
返回值:boolean
script_api.minecraft/server.entity.isvalid.return
kill

script_api.minecraft/server.entity.kill.description

kill(): boolean
返回值:boolean
script_api.minecraft/server.entity.kill.return
removeEffect

script_api.minecraft/server.entity.removeeffect.description

removeEffect(effectType: EffectType | string): boolean
removeTag

script_api.minecraft/server.entity.removetag.description

removeTag(tag: string): boolean
runCommand

script_api.minecraft/server.entity.runcommand.description

runCommand(commandString: string): CommandResult
runCommandAsync

script_api.minecraft/server.entity.runcommandasync.description

runCommandAsync(commandString: string): Promise<CommandResult>
teleport

script_api.minecraft/server.entity.teleport.description

teleport(location: Vector3, teleportOptions?: TeleportOptions): void
triggerEvent

script_api.minecraft/server.entity.triggerevent.description

triggerEvent(eventName: string): void
tryTeleport

script_api.minecraft/server.entity.tryteleport.description

tryTeleport(location: Vector3, teleportOptions?: TeleportOptions): boolean