mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-13 22:25:50 +01:00
Adjust crafting progression from shift-click, by Lokio27
This commit is contained in:
parent
92412a89ff
commit
60a1f5b119
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user