Skip to content

Commit

Permalink
Fix tasty paste advancement triggering with an empty canteen
Browse files Browse the repository at this point in the history
  • Loading branch information
pupnewfster committed Mar 3, 2024
1 parent eefbe03 commit 55a93cf
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package mekanism.common.item.predicate;

import com.mojang.serialization.Codec;
import java.util.List;
import mekanism.api.fluid.IExtendedFluidTank;
import mekanism.common.attachments.containers.ContainerType;
import mekanism.common.item.gear.ItemCanteen;
import mekanism.common.registries.MekanismFluids;
Expand All @@ -23,8 +25,8 @@ public Codec<? extends ICustomItemPredicate> codec() {
@Override
public boolean test(@NotNull ItemStack stack) {
if (stack.getItem() instanceof ItemCanteen) {
return ContainerType.FLUID.getAttachmentContainersIfPresent(stack).stream()
.allMatch(tank -> tank.getNeeded() == 0 && tank.getFluid().is(MekanismFluids.NUTRITIONAL_PASTE.getFluid()));
List<IExtendedFluidTank> tanks = ContainerType.FLUID.getAttachmentContainersIfPresent(stack);
return !tanks.isEmpty() && tanks.stream().allMatch(tank -> tank.getNeeded() == 0 && tank.getFluid().is(MekanismFluids.NUTRITIONAL_PASTE.getFluid()));
}
return false;
}
Expand Down

0 comments on commit 55a93cf

Please sign in to comment.