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

This commit is contained in:
nossr50 2024-09-14 15:08:26 -07:00
parent 5cc97383fa
commit 88cacf8fff
3 changed files with 8 additions and 13 deletions

View File

@ -1,9 +1,11 @@
Version 2.2.020 Version 2.2.020
(Codebase) Reworked Roll implementation (See notes) (Codebase) Reworked Roll implementation (See notes)
(Codebase) Added unit test coverage for Roll (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 Fixed a bug where Roll was modifying damage unnecessarily
NOTES: 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. 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. 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. This would be a good time to suggest changes to Acrobatics on discord.

View File

@ -344,13 +344,6 @@ public class PotionConfig extends LegacyConfigLoader {
.stream() .stream()
.filter(potion -> potion.isSimilarPotion(item, itemMeta)) .filter(potion -> potion.isSimilarPotion(item, itemMeta))
.toList(); .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); return potionList.isEmpty() ? null : potionList.get(0);
} }

View File

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