Spice of Life: Carrot Edition

Spice of Life: Carrot Edition

57M Downloads

Suggestion for how to count Cake as a food

tarinoita opened this issue ยท 1 comments

commented

I've updated SoL: Sweet Potato to register Cake as a food item when eaten off the block, via this event listener. It's not a perfect solution, and may cause conflicts with other mods (I've only tested it with SoL: Carrot and Farmer's Delight so far), but I feel it's better than the awkward gap left by not recognizing cake as food.

As you can see on line 64, I'm firing an event when the cake is eaten, which forces compatibility with SoL: Carrot as long as Farmer's Delight is installed (otherwise, the technically non-edible Cake gets filtered out by your listener). If you choose to duplicate this code (which you're welcome to!) or otherwise add a similar listener of your own, please let me know, as in that case we should both update our food books directly instead of firing an event. (Presumably you'll also need to update the code which counts total eligible food items--I haven't looked at that, since Potato doesn't include it.)

Unfortunately, it's kind of a pain for me to submit a PR for this, as Sweet Potato is technically already a much-diverged fork, and I can't make another under my same Github account. But I'm happy to try to figure it out if that would help!

Thanks for all your work on the mod!

commented

Thanks for the suggestion and implementation! I've been weighing the pros and cons of adding this, and I think supporting cake is not important enough to me to justify hardcoding what's a cake and even changing which item to count as depending on loaded mods. It's a valid implementation, but personally I'd rather keep the codebase free of hacks like that :)