diff --git a/src/main/java/net/guizhanss/fastmachines/items/machines/generic/FastMachineCache.java b/src/main/java/net/guizhanss/fastmachines/items/machines/generic/FastMachineCache.java index e29f831..77c2bc4 100644 --- a/src/main/java/net/guizhanss/fastmachines/items/machines/generic/FastMachineCache.java +++ b/src/main/java/net/guizhanss/fastmachines/items/machines/generic/FastMachineCache.java @@ -255,7 +255,7 @@ private void craft(final Player p, final int amount, int tries) { // push the product if (recipe.getKey() instanceof RandomRecipe randomRecipe) { boolean machineFull = false; - for (int i = 0; i < amount; i++) { + for (int i = 0; i < actualAmount; i++) { ItemStack product = randomRecipe.getOutput(blockPosition.getWorld()).clone(); if (MachineUtils.addItem(p, menu, OUTPUT_SLOTS, product, 1)) { machineFull = true; @@ -266,7 +266,7 @@ private void craft(final Player p, final int amount, int tries) { } } else { ItemStack product = recipe.getKey().getOutput(blockPosition.getWorld()).clone(); - if (MachineUtils.addItem(p, menu, OUTPUT_SLOTS, product, amount)) { + if (MachineUtils.addItem(p, menu, OUTPUT_SLOTS, product, actualAmount)) { FastMachines.getLocalization().sendMessage(p, "not-enough-space"); } } diff --git a/src/main/java/net/guizhanss/fastmachines/utils/MachineUtils.java b/src/main/java/net/guizhanss/fastmachines/utils/MachineUtils.java index d2efc4d..aa508ca 100644 --- a/src/main/java/net/guizhanss/fastmachines/utils/MachineUtils.java +++ b/src/main/java/net/guizhanss/fastmachines/utils/MachineUtils.java @@ -162,7 +162,7 @@ public static int addItem(BlockMenu menu, int[] slots, ItemStack item, int amoun * @param slots The slots of machine to add {@link ItemStack} to. * @param item The {@link ItemStack} to add. * @param amount The amount of {@link ItemStack}s to add. - * @return The remaining amount of {@link ItemStack}s. + * @return Whether there are remaining items after pushing to machine slots. */ @ParametersAreNonnullByDefault public static boolean addItem(Player p, BlockMenu menu, int[] slots, ItemStack item, int amount) {