toData method
Implementation
Data toData([DataStorage? target]) {
target ??= DataStorage(name);
if (_type == _StorageType.merge) return Data.merge(target, nbt: nbt);
if (_type == _StorageType.get) {
return Data.get(target, path: key!, scale: scale);
}
if (_type == _StorageType.remove) return Data.remove(target, path: key!);
if (_type == _StorageType.modify) {
return Data.modify(
target,
path: key!,
modify: _modify,
);
}
if (_type == _StorageType.data && data != null) {
return Data.modify(
target,
path: key!,
modify: DataModify.set(data!.target, fromPath: data!.path),
);
}
if (_type == _StorageType.score) {
return Data.fromScore(
target,
path: key!,
score: score,
scale: scale,
datatype: datatype,
);
}
throw ("You have to invoke some action on Storage when using toData!");
}