Skip to content

Commit

Permalink
fix: Fix refill last dupe bug #235
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Dec 25, 2024
1 parent d074c71 commit 2c62f4c
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ private boolean hasUsesLeft(int slot, ItemStack slotStack, Collection<Ingredient

public class ContainerIngredientToken implements IngredientToken, IngredientCacheHint {
private final int slot;
private boolean returnRemainder;

public ContainerIngredientToken(int slot) {
this.slot = slot;
Expand All @@ -89,8 +90,10 @@ public ItemStack peek() {
@Override
public ItemStack consume() {
final var consumed = ContainerUtils.extractItem(container, slot, 1, false);
final var remainingItem = Balm.getHooks().getCraftingRemainingItem(consumed);
ContainerUtils.insertItem(container, slot, remainingItem, false);
if (returnRemainder) {
final var remainingItem = Balm.getHooks().getCraftingRemainingItem(consumed);
ContainerUtils.insertItem(container, slot, remainingItem, false);
}
return consumed;
}

Expand Down

0 comments on commit 2c62f4c

Please sign in to comment.