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.


forceProvidedPositionOnDimensionChange?

optional forceProvidedPositionOnDimensionChange?: boolean

Beta


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.