神岛 API 文档 - ArenaPro版
    Preparing search index...

    实体是游戏中的游戏对象,可以用来表示玩家、物体等。

    An entity is a game object in the game, which can be used to represent players, objects, etc.

    Implements

    Index

    Other

    animate: (
        keyframes: Partial<GameEntityKeyframe>[],
        playbackInfo?: Partial<GameAnimationPlaybackConfig>,
    ) => GameAnimation<GameEntityKeyframe, GameEntity>

    Type declaration

    在实体上播放动画。

    Plays an animation on the entity.

    Type declaration

    获取实体当前播放的所有动画。

    Gets all animations currently playing on the entity.

    下一次玩家点击此实体时的未来事件。

    A future event for the next time a player clicks this entity.

    下一次实体接触另一个实体时的未来事件。

    A future event for the next time the entity contacts another entity.

    下一次实体与另一个实体互动时的未来事件。

    A future event for the next time the entity interacts with another entity.

    当玩家点击此实体时调用。

    Called when a player clicks this entity.

    chat

    say: (
        message: string,
        options?: Partial<{ duration: number; hideFloat: boolean }>,
    ) => void

    Type declaration

      • (
            message: string,
            options?: Partial<{ duration: number; hideFloat: boolean }>,
        ): void
      • Parameters

        • message: string

          The message to say. @zh_param message 要说的信息。

        • Optionaloptions: Partial<{ duration: number; hideFloat: boolean }>

          Options for saying the message. @zh_param options 说话的选项。

        Returns void

    使实体说话。

    Makes the entity say something.

    destroy

    destroy: () => void

    销毁实体。

    Destroys the entity.

    destroyed: boolean

    如果为 true,表示实体已被销毁。

    If true, indicates that the entity has been destroyed.

    下一次实体被销毁时的未来事件。

    A future event for the next time the entity is destroyed.

    当实体被销毁时调用。

    Called when the entity is destroyed.

    entityName

    customName: string

    实体名称

    The entity's name.

    nameColor: GameRGBColor

    实体名称的颜色

    The color of the entity's name.

    nameRadius: number

    显示实体名称的半径范围

    The radius range for displaying the entity's name.

    showEntityName: boolean

    显示实体名称

    Whether to display the entity's name.

    health

    enableDamage: boolean

    是否启用伤害。

    Whether damage is enabled.

    hp: number

    当前生命值。

    The current health points.

    hurt: (amount: number, options?: Partial<GameHurtOptions>) => void

    Type declaration

      • (amount: number, options?: Partial<GameHurtOptions>): void
      • Parameters

        • amount: number

          The amount of damage to inflict. @zh_param amount 伤害量。

        • Optionaloptions: Partial<GameHurtOptions>

          Options for the damage. @zh_param options 伤害选项。

        Returns void

    对实体造成伤害。

    Inflicts damage on the entity.

    maxHp: number

    最大生命值。

    The maximum health points.

    下一次实体死亡时的未来事件。

    A future event for the next time the entity dies.

    下一次实体受到伤害时的未来事件。

    A future event for the next time the entity takes damage.

    当实体死亡时调用。

    Called when the entity dies.

    当实体受到伤害时调用。

    Called when the entity takes damage.

    showHealthBar: boolean

    是否显示生命条。

    Whether to show the health bar.

    interact

    enableInteract: boolean

    启用交互

    interactColor: GameRGBColor

    交互提示文本的颜色

    The color of the interaction prompt text.

    interactHint: string

    交互实体的提示文本

    The prompt text for the interactive entity.

    interactRadius: number

    交互的半径范围

    The radius range for interaction.

    interactive

    当实体与另一个实体互动时调用。

    Called when the entity interacts with another entity.

    mesh

    anchorOffset: GameVector3

    几何中心与锚点的偏移量。

    The offset of the geometric center from the anchor point.

    lookAt: (
        targetPosition: GameVector3,
        facingDirection?: "X" | "Y" | "Z",
        up?: GameVector3,
    ) => void

    Type declaration

      • (
            targetPosition: GameVector3,
            facingDirection?: "X" | "Y" | "Z",
            up?: GameVector3,
        ): void
      • Parameters

        • targetPosition: GameVector3

          The position to look at. @zh_param targetPosition 要朝向的位置。

        • OptionalfacingDirection: "X" | "Y" | "Z"

          The direction that should face the target. @zh_param facingDirection 应朝向目标的方向。

        • Optionalup: GameVector3

          The up vector. @zh_param up 上方向向量。

        Returns void

    使实体朝向指定位置。

    Makes the entity look at a specified position.

    mesh: any

    实体网格的哈希值。如果设置为空字符串,则实体没有网格。 除非对象是玩家,否则如果设置了网格,则使用网格来计算对象的边界。

    The hash of the entity's mesh. If set to an empty string, the entity has no mesh. Unless the object is a player, if a mesh is set, it is used to calculate the object's bounds.

    meshColor: GameRGBAColor

    网格颜色。

    The mesh color.

    meshEmissive: number

    网格发光度。

    The mesh emissive intensity.

    meshInvisible: boolean

    使网格不可见。

    Makes the mesh invisible.

    meshMetalness: number

    网格金属度。

    The mesh metalness.

    meshOffset: GameVector3

    网格偏移。

    The mesh offset.

    meshOrientation: GameQuaternion

    网格方向。

    The mesh orientation.

    meshScale: GameVector3

    网格缩放。

    The mesh scale.

    meshShininess: number

    网格光泽度。

    The mesh shininess.

    rotateLocal: (
        localPosition: GameVector3,
        axis: "X" | "Y" | "Z",
        rad: number,
    ) => void

    Type declaration

      • (localPosition: GameVector3, axis: "X" | "Y" | "Z", rad: number): void
      • Parameters

        • localPosition: GameVector3

          A 3D vector containing x, y, z coordinates, representing the position to rotate around. @zh_param localPosition 一个包含x、y、z坐标的三维向量,表示待旋转的位置。

        • axis: "X" | "Y" | "Z"

          A string specifying the rotation axis, can be 'X', 'Y', or 'Z'. @zh_param axis 一个字符串,指定旋转轴可以是'X'、'Y'或'Z'。

        • rad: number

          The angle of rotation in radians. @zh_param rad 旋转的角度,以弧度为单位。

        Returns void

    围绕模型自身坐标系下的某个点进行旋转。

    Rotates around a point in the model's own coordinate system.

    scaleLocal: (localPosition: GameVector3, v: GameVector3) => void

    Type declaration

      • (localPosition: GameVector3, v: GameVector3): void
      • Parameters

        • localPosition: GameVector3

          The position vector in the local coordinate system, representing the point to scale around. @zh_param localPosition 本地坐标系中的位置向量,表示待缩放的点。

        • v: GameVector3

          The scaling vector, representing the scaling factors on the x, y, and z axes. @zh_param v 缩放向量,表示在x、y、z轴上的缩放因子。

        Returns void

    参照模型自身坐标系下的某个点进行缩放。

    Scales relative to a point in the model's own coordinate system.

    motion

    运动控制器。

    The motion controller.

    particle

    particleAcceleration: GameVector3

    粒子加速度/重力力矢量 单位是方块/(滴答^2)

    particleColor: GameRGBColor[]

    粒子颜色样条曲线。最多 5 个条目,粒子在其生命周期内沿这 5 个点插值颜色。 颜色是发光值,可以在 0 到 256 之间取任何值。

    The particle color spline. Up to 5 entries, particles interpolate colors along these 5 points during their lifetime. Colors are emissive values and can take any value between 0 and 256.

    particleDamping: number

    粒子阻尼指数。0 = 无阻尼,正值减慢粒子,负值加速粒子。

    The particle damping index. 0 = no damping, positive values slow down particles, negative values accelerate them.

    particleLifetime: number

    控制每个粒子的生命周期(以秒为单位)。

    Controls the lifetime of each particle (in seconds).

    particleLifetimeSpread: number

    粒子生命周期的变化范围(以秒为单位)。

    The variation range of particle lifetime (in seconds).

    particleLimit: number

    该实体可以发射的最大粒子数。

    The maximum number of particles this entity can emit.

    particleNoise: number

    粒子噪声幅度。影响粒子运动

    particleNoiseFrequency: number

    粒子噪声频率。增加噪声偏置的运动速率

    particleRate: number

    粒子发射速率(每秒粒子数)。

    The particle emission rate (particles per second).

    particleRateSpread: number

    粒子发射的变化范围。

    The spread of the particle emission rate.

    particleSize: number[]

    粒子大小样条曲线。最多 5 个条目,粒子在其生命周期内沿这 5 个点插值大小。

    The particle size spline. Up to 5 entries, particles interpolate sizes along these 5 points during their lifetime.

    particleSizeSpread: number

    粒子大小分布。

    The distribution of particle sizes.

    particleTarget: GameEntity

    粒子目标实体

    particleTargetWeight: number

    粒子目标权重

    particleVelocity: GameVector3

    粒子速度偏置。单位是方块/滴答。

    The particle velocity offset. Unit is voxels/tick.

    particleVelocitySpread: GameVector3

    粒子速度随机化范围。单位是方块/滴答。

    The randomization range of particle velocity. Unit is voxels/tick.

    physics

    bounds: GameVector3

    实体边界框在 x/y/z 轴上的半径。

    The radius of the entity's bounding box on the x/y/z axes.

    collides: boolean

    如果为 false,物体不会发生碰撞。

    If false, the object will not collide.

    contactForce: GameVector3

    应用于此对象的净接触力。

    The net contact force applied to this object.

    entityContacts: GameEntityContact[]

    返回所有活动的实体接触列表。

    Returns a list of all active entity contacts.

    fixed: boolean

    如果为 true,物体不会移动。

    If true, the object will not move.

    fluidContacts: GameFluidContact[]

    返回所有活动的流体接触列表。

    Returns a list of all active fluid contacts.

    friction: number

    控制物体的粘性(0 = 滑,1 = 粘)。

    Controls the friction of the object (0 = slippery, 1 = sticky).

    gravity: boolean

    如果为 false,物体不会受到重力影响。

    If false, the object is not affected by gravity.

    mass: number

    实体的质量。

    The mass of the entity.

    下一次实体停止接触另一个实体时的未来事件。

    A future event for the next time the entity stops contacting another entity.

    下一次实体进入流体时的未来事件。

    A future event for the next time the entity enters a fluid.

    下一次实体离开流体时的未来事件。

    A future event for the next time the entity leaves a fluid.

    下一次实体接触方块时的未来事件。

    A future event for the next time the entity contacts a voxel.

    下一次实体停止接触方块时的未来事件。

    A future event for the next time the entity stops contacting a voxel.

    当实体接触另一个实体时调用。

    Called when the entity contacts another entity.

    当实体停止接触另一个实体时调用。

    Called when the entity stops contacting another entity.

    当实体进入流体时调用。

    Called when the entity enters a fluid.

    当实体离开流体时调用。

    Called when the entity leaves a fluid.

    当实体接触方块时调用。

    Called when the entity contacts a voxel.

    当实体停止接触方块时调用。

    Called when the entity stops contacting a voxel.

    position: GameVector3

    实体的位置。

    The position of the entity.

    restitution: number

    控制弹跳性(0 = 软,1 = 弹)。

    Controls the bounciness (0 = soft, 1 = bouncy).

    velocity: GameVector3

    实体的速度。

    The velocity of the entity.

    voxelContacts: GameVoxelContact[]

    返回所有活动的方块接触列表。

    Returns a list of all active voxel contacts.

    player

    isPlayer: boolean

    如果为 true,则该实体是玩家

    If true, this entity is a player.

    已废弃。请直接使用 if (entity.player) 进行玩家实体存在性检查,这能让TypeScript自动推断出 GameEntity.player 在该代码块中是已定义的 GamePlayer 类型,从而提高类型安全性。

    Deprecated. Please use if (entity.player) directly to check for player entity existence. This allows TypeScript to automatically infer that GameEntity.player is a defined GamePlayer type within that code block, improving type safety.

    player: GamePlayer

    如果实体是玩家,则此属性存在。包含所有特定于玩家的状态和方法的引用。

    If the entity is a player, this property exists. It contains references to all player-specific states and methods.

    selectors

    addTag: (tag: string) => void

    Type declaration

      • (tag: string): void
      • Parameters

        • tag: string

          The tag to add. @zh_param tag 要添加的标签。

        Returns void

    向实体添加新标签。

    Adds a new tag to the entity.

    hasTag: (tag: string) => boolean

    Type declaration

      • (tag: string): boolean
      • Parameters

        • tag: string

          The tag to test for. @zh_param tag 要测试的标签。

        Returns boolean

        @zh_returns 如果实体有该标签则返回 true,否则返回 false。 @en_returns True if the entity has the tag, otherwise false.

    测试实体是否具有某个标签。

    Tests if the entity has a certain tag.

    id: string

    实体在编辑器中的种子名称。

    The entity's seed name in the editor.

    removeTag: (tag: string) => void

    Type declaration

      • (tag: string): void
      • Parameters

        • tag: string

          The tag to remove. @zh_param tag 要移除的标签。

        Returns void

    从实体中移除标签。

    Removes a tag from the entity.

    tags: () => string[]

    获取分配给实体的所有标签集合。

    Gets the collection of all tags assigned to the entity.

    sound

    chatSound: GameSoundEffect

    当实体聊天时播放的声音

    The sound played when the entity chats.

    dieSound: GameSoundEffect

    当实体死亡时播放的声音

    The sound played when the entity dies.

    hurtSound: GameSoundEffect

    当实体受到伤害时播放的声音

    The sound played when the entity is hurt.

    interactSound: GameSoundEffect

    当实体被交互时播放的声音

    The sound played when the entity is interacted with.

    sound: (spec: any) => Sound

    Type declaration

      • (spec: any): Sound
      • Parameters

        • spec: any

          The sound specification. This can be an audio asset string, an empty string to stop the sound, or a configuration object with the following properties:

          • sample: The audio asset (GameAudioAssets | '').
          • radius: The sound radius (optional).
          • pitch: The pitch (optional).
          • gain: The gain (optional). @zh_param spec 音效规格。可以是一个音频资源字符串,一个用于停止音效的空字符串,或一个包含以下属性的配置对象:
          • sample: 音频资源 (GameAudioAssets | '')。
          • radius: 音效半径(可选)。
          • pitch: 音调(可选)。
          • gain: 音量(可选)。

        Returns Sound

        The sound instance. @zh_returns 音效实例。

    在实体位置播放音效。

    Plays a sound effect at the entity's position.