private static void transformObject(NetObjectList <Item> items, SObject item, CustomCropsDecayData data) { if (data.decayDays.TryGetValue(item.Quality, out int decayDays)) { if (item is ColoredObject coloredObject) { ColoredCropWithDecay crop = ColoredCropWithDecay.copyFrom(coloredObject); crop.decayDays = decayDays; for (int i = 0; i < items.Count; i++) { if (items[i] == item) { items[i] = crop; } } } else { CropWithDecay crop = CropWithDecay.copyFrom(item); crop.decayDays = decayDays; for (int i = 0; i < items.Count; i++) { if (items[i] == item) { items[i] = crop; } } } } }
public ICustomObject recreate(Dictionary <string, string> additionalSaveData, object replacement) { return(CropWithDecay.copyFrom((SObject)replacement)); }