浏览代码

Alchemy no longer spams when finding potions of the same type in config Fixes #5081 Fixes #5059

nossr50 1 年之前
父节点
当前提交
88cacf8fff

+ 2 - 0
Changelog.txt

@@ -1,9 +1,11 @@
 Version 2.2.020
     (Codebase) Reworked Roll implementation (See notes)
     (Codebase) Added unit test coverage for Roll
+    Fixed error spam in mcMMO potion matching logic (see notes)
     Fixed a bug where Roll was modifying damage unnecessarily
 
     NOTES:
+    I'll need to rework Alchemy a bit further to address some issues I've found, for now mcMMO will ignore harmless matching errors in the potion matching logic.
     The code for Roll was a bit of a mess, I've rewritten a good chunk of it and added some unit test coverage.
     I will likely put out another update for Acrobatics in general, as the code for Acrobatics is whack.
     This would be a good time to suggest changes to Acrobatics on discord.

+ 0 - 7
src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java

@@ -344,13 +344,6 @@ public class PotionConfig extends LegacyConfigLoader {
                 .stream()
                 .filter(potion -> potion.isSimilarPotion(item, itemMeta))
                 .toList();
-        if(potionList.size() > 1) {
-            mcMMO.p.getLogger().severe("Multiple potions defined in config have matched this potion, for mcMMO to behave" +
-                    " properly there should only be one match found.");
-            mcMMO.p.getLogger().severe("Potion ItemStack:" + item.toString());
-            mcMMO.p.getLogger().severe("Alchemy Potions from config matching this item: "
-                    + potionList.stream().map(AlchemyPotion::toString).collect(Collectors.joining(", ")));
-        }
 
         return potionList.isEmpty() ? null : potionList.get(0);
     }

+ 6 - 6
src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java

@@ -189,18 +189,18 @@ public final class AlchemyPotionBrewer {
 
         // Process each of the three slots in the brewing stand
         for (int i = 0; i < 3; i++) {
-            ItemStack item = inventory.getItem(i);
+            final ItemStack potionInBrewStandInputSlot = inventory.getItem(i);
 
             // Skip the slot if it's empty, contains a glass bottle, or holds an invalid potion
-            if (isEmpty(item)
-                    || item.getType() == Material.GLASS_BOTTLE
-                    || !mcMMO.p.getPotionConfig().isValidPotion(item)) {
+            if (isEmpty(potionInBrewStandInputSlot)
+                    || potionInBrewStandInputSlot.getType() == Material.GLASS_BOTTLE
+                    || !mcMMO.p.getPotionConfig().isValidPotion(potionInBrewStandInputSlot)) {
                 // debug
                 continue;
             }
 
             // Retrieve the potion configurations for the input and resulting output potion
-            AlchemyPotion input = mcMMO.p.getPotionConfig().getPotion(item);
+            AlchemyPotion input = mcMMO.p.getPotionConfig().getPotion(potionInBrewStandInputSlot);
             AlchemyPotion output = input.getChild(ingredient);
 
             // Update the input list with the current potion
@@ -208,7 +208,7 @@ public final class AlchemyPotionBrewer {
 
             // If there is a valid output potion, add it to the output list
             if (output != null) {
-                outputList.set(i, output.toItemStack(item.getAmount()).clone());
+                outputList.set(i, output.toItemStack(potionInBrewStandInputSlot.getAmount()).clone());
             }
         }