Stormwind99 / FoodFunk

Minecraft mod: What is that funky smell in my backpack? Food spoils over time unless preserved. Configure any item to rot, any container to preserve items.
https://minecraft.curseforge.com/projects/food-funk
GNU Lesser General Public License v3.0
10 stars 8 forks source link

Crafted food already rotted #57

Closed T3chW0lf20 closed 4 years ago

T3chW0lf20 commented 5 years ago

Describe the bug I wanted to make something last a long time, erse jam in my case, but when I craft it, it's automaticaly 96% rotten

To Reproduce Steps to reproduce the behavior:

  1. change craft-able food items "days to rot" to 200
  2. craft item in game
  3. item is already at 193 days

Expected behavior I expect the item to last 200 days, but now it just lasts 7.

Logs 2019-05-25-6.log.gz

Codetoil commented 4 years ago

Items that are rotted combine to produce rotted food. What is likely happening is that the ingredients of erse jam are already rotted, meaning that this is likely intentional.

Stormwind99 commented 4 years ago

@Codetoil is correct - to avoid cheating away the rot of food by crafting new items out of rotting food, Food Funk transfers the rot of ingredients to the crafted item.

See the following code from Wumple Util (my library that Food Funk uses):

It has been a while since I wrote it and these code comments might be outdated, but here is some info from ThingTimerEventHandler.onCrafted:

    // Avoid cheating from crafting or break rotting items

    // For example: 
    // Melon 0/14 days -> Slices 0/7 days -> Melon 0/7 days or 7/14 days
    // Melon 8/14 days -> Slices 6/7 days -> Melon 6/7 days or 13/14 days
    // Crafting: Ingredients 1/7, 2/7, 3/7 days -> Results 3/7 days
    // Crafting: Ingredients 1/7, 2/7, 3/7 days -> Results 10/14 days
    // Crafting: Ingredients 5/14, 6/14 -> Results 0/7 days
    // Crafting: Ingredients 6/14, 9/14 -> Results 2/7 days

I'll close this issue assuming this (crafting food from rotting food) is the case, but if it isn't feel free to comment and we can re-open the issue.