Skip to content

Commit

Permalink
fix: fix #36
Browse files Browse the repository at this point in the history
  • Loading branch information
ybw0014 committed Feb 28, 2024
1 parent 2aa5820 commit c828aaa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c828aaa

Please sign in to comment.