teleport method

RestActionAble teleport({
  1. Location? location,
  2. Entity? entity,
  3. dynamic facing,
  4. Rotation? rot,
})

Generates a Teleport Widget

entity.teleport(Location.here()).queue()

Implementation

RestActionAble teleport({
  Location? location,
  Entity? entity,
  dynamic facing,
  Rotation? rot,
}) {
  //Teleport to entity
  if (entity != null && facing != null) {
    return StraitWidget.builder
        .create(Teleport.entity(this, to: entity, facing: facing));
  }

  if (entity != null) {
    return StraitWidget.builder.create(Teleport.entity(this, to: entity));
  }

  // Teleport to Location
  if (location != null && facing != null && rot != null) {
    return StraitWidget.builder
        .create(Teleport(this, to: location, facing: facing, rot: rot));
  }

  if (location != null && facing != null) {
    return StraitWidget.builder
        .create(Teleport(this, to: location, facing: facing));
  }

  if (location != null && rot != null) {
    return StraitWidget.builder
        .create(Teleport(this, to: location, rot: rot));
  }

  if (location != null) {
    return StraitWidget.builder.create(Teleport(this, to: location));
  }
  throw Error();
}