copyWith method

Item copyWith({
  1. String? type,
  2. int? count,
  3. int? damage,
  4. Slot? slot,
  5. int? model,
  6. int? hideFlags,
  7. TextComponent? name,
  8. List<TextComponent>? lore,
  9. Map<String, dynamic>? nbt,
})

Implementation

Item copyWith({
  String? type,
  int? count,
  int? damage,
  Slot? slot,
  int? model,
  int? hideFlags,
  TextComponent? name,
  List<TextComponent>? lore,
  Map<String, dynamic>? nbt,
}) {
  final t = tag != null
      ? tag!.deepCopy().cast<String, dynamic>()
      : <String, dynamic>{};
  _checkTags(model, type, hideFlags, name, lore, nbt, t);

  return Item(
    type ?? this.type,
    count: count ?? this.count,
    damage: damage ?? this.damage,
    slot: slot ?? this.slot,
    nbt: t,
  );
}