Skip to content

Commit

Permalink
Fix charms being craftable with empty potions
Browse files Browse the repository at this point in the history
Closes #1469
  • Loading branch information
Shadows-of-Fire committed Feb 2, 2025
1 parent b0a9a07 commit d7ea925
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,17 @@ public static PotionContents findPotion(CraftingInput input) {
ItemStack stack = input.getItem(i);
PotionContents contents = stack.get(DataComponents.POTION_CONTENTS);

if (contents == null || !PotionCharmItem.isValidPotion(contents.potion().orElse(Potions.WATER))) {
if (contents == null) {
continue;
}

// If we run into an invalid potion, bail.
if (!PotionCharmItem.isValidPotion(contents.potion().orElse(Potions.WATER))) {
return PotionContents.EMPTY;
}

// If we haven't found one yet, and we find one, retain it.
if (found == PotionContents.EMPTY && contents != PotionContents.EMPTY) {
if (found == PotionContents.EMPTY) {
found = contents;
}
else if (!contents.equals(found)) {
Expand Down

0 comments on commit d7ea925

Please sign in to comment.