DieReicheErethons / Brewery

GNU General Public License v3.0
161 stars 182 forks source link

Ingredient and Fermentation Quality Color Does Not Update In Barrel #603

Open AlgebraManiacABC opened 8 months ago

AlgebraManiacABC commented 8 months ago

I have been running some experiments to find the highest quality of a particular brew on a server I play on. I started to notice that the ingredient and/or the fermentation color would change if I took a brew out of the barrel and put it back in. I was highly confused at this at first, but then I realized it was because aging a drink does not update these values. I have double checked the source code and I believe that the age() method does not update the ingredient nor fermentation lore on a Brew.

Normally, this would make sense, as you cannot change the ingredients nor the cook time in a barrel. However, if the highest quality recipe changes due to aging, then the new recipe's ingredients/fermentation will not be updated to reflect the new recipe. I have tried this with a drink whose recipe I know (3 wheat, 1 sugar), which only becomes the topmost recipe after some aging. Before this point, it is the recipe of a brew that only takes 3 wheat, and its ingredient lore was yellow. Upon aging into the new brew, the ingredient quality was still yellow. I picked it up and set it back into the barrel, and after a minute (when the lore was updated via convertLore) it showed green ingredient lore. I have also observed this phenomenon with fermentation quality, which I notice is also absent from age().

To fix this, I propose the following change:

Line 723 of Brew.java:

        // Lore
        if (currentRecipe != null && BConfig.colorInBarrels != BrewLore.hasColorLore(potionMeta)) {
            lore.convertLore(BConfig.colorInBarrels);
        } else {
            if (ageTime >= 1) {
                lore.updateAgeLore(BConfig.colorInBarrels);
            }
            if (ageTime > 0.5) {
                if (BConfig.colorInBarrels) {
                    lore.updateWoodLore(true);
+                   lore.updateIngredientLore(true);
+                   lore.updateCookLore(true);
                }
                lore.updateQualityStars(BConfig.colorInBarrels);
                lore.updateCustomLore();
                lore.updateAlc(false);
            }
        }
        lore.write();

There should just be updates to ingredient and cook lore in the shown if. Or, at least, if you detect the "best" recipe has changed. It wouldn't hurt to update every time anyway though.