From 60a1f5b11925c8296dbb4174e4cfec8ae7bf9996 Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Thu, 1 Apr 2021 23:39:05 -0400 Subject: [PATCH] Adjust crafting progression from shift-click, by Lokio27 --- .../java/me/blackvein/quests/listeners/ItemListener.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main/src/main/java/me/blackvein/quests/listeners/ItemListener.java b/main/src/main/java/me/blackvein/quests/listeners/ItemListener.java index 15528a788..d39d83fa9 100644 --- a/main/src/main/java/me/blackvein/quests/listeners/ItemListener.java +++ b/main/src/main/java/me/blackvein/quests/listeners/ItemListener.java @@ -75,10 +75,13 @@ public class ItemListener implements Listener { if (evt.isShiftClick()) { final ItemStack recipeResult = evt.getRecipe().getResult(); final int resultAmt = recipeResult.getAmount(); // Bread = 1, Cookie = 8, etc. - int leastIngredient = 1; + int leastIngredient = -1; for (final ItemStack item : evt.getInventory().getMatrix()) { if (item != null && !item.getType().equals(Material.AIR)) { - leastIngredient = item.getAmount() * resultAmt; + final int re = item.getAmount() * resultAmt; + if (leastIngredient == -1 || re < leastIngredient) { + leastIngredient = re; + } } } return new ItemStack(recipeResult.getType(), leastIngredient, recipeResult.getDurability());