copyWith method

Entity copyWith({
  1. int? limit,
  2. List? tags,
  3. Team? team,
  4. List<Score>? scores,
  5. Map<String, dynamic>? nbt,
  6. String? strNbt,
  7. EntityType? type,
  8. Area? area,
  9. Range? distance,
  10. Range? level,
  11. Gamemode? gamemode,
  12. String? name,
  13. Rotation? isRotated,
  14. Range? horizontalRotation,
  15. Range? verticalRotation,
  16. String? predicate,
})

Creates a new Entity based on the existing one and applies new arguments. (same as constructors)

Example:

Entity ent1 = Entity(type:Entities.sheep)
Entity ent2 = ent1.copyWith(distance:Range.to(1))

Implementation

Entity copyWith({
  int? limit,
  List<dynamic>? tags,
  Team? team,
  List<Score>? scores,
  Map<String, dynamic>? nbt,
  String? strNbt,
  EntityType? type,
  Area? area,
  Range? distance,
  Range? level,
  Gamemode? gamemode,
  String? name,
  Rotation? isRotated,
  Range? horizontalRotation,
  Range? verticalRotation,
  String? predicate,
}) {
  var temp = Entity.clone(this);
  temp._setArguments(
    limit,
    tags,
    team,
    scores,
    nbt,
    strNbt,
    type,
    area,
    distance,
    level,
    gamemode,
    name,
    isRotated,
    horizontalRotation,
    verticalRotation,
    predicate,
    false,
  );
  return temp;
}