For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /server/interfaces/TeleportOptions.md.

Interface: TeleportOptions

Beta

包含传送实体的额外选项。

Contains additional options for teleporting an entity.

Examples

teleport.ts
teleportMovement.ts
import { system, DimensionLocation } from '@minecraft/server';
import { MinecraftEntityTypes } from '@minecraft/vanilla-data';

function teleport(targetLocation: DimensionLocation) {
  const cow = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Cow, targetLocation);

  system.runTimeout(() => {
    cow.teleport(
      { x: targetLocation.x + 2, y: targetLocation.y + 2, z: targetLocation.z + 2 },
      {
        facingLocation: targetLocation,
      }
    );
  }, 20);
}

Properties

checkForBlocks?

optional checkForBlocks?: boolean

Beta

Remarks

是否检查传送后方块是否会阻挡实体。

Whether to check whether blocks will block the entity after teleport.


dimension?

optional dimension?: Dimension

Beta

Remarks

可能将实体移动到的维度。如果未指定,实体将在其所在的维度内传送。

Dimension to potentially move the entity to. If not specified, the entity is teleported within the dimension that they reside.


facingLocation?

optional facingLocation?: Vector3

Beta

Remarks

传送后实体应面向的位置。

Location that the entity should be facing after teleport.


keepVelocity?

optional keepVelocity?: boolean

Beta

Remarks

传送后是否保留实体的速度。

Whether to retain the entities velocity after teleport.


rotation?

optional rotation?: Vector2

Beta

Remarks

传送后实体的旋转角度。

Rotation of the entity after teleport.