Skip to content

Commit

Permalink
Don't execute empty commands when an item cannot be collected to a gi…
Browse files Browse the repository at this point in the history
…ven item stack.

fixes #871 (technically it fixes only the symptoms, not the root cause. The root cause is probably #865
  • Loading branch information
IntegratedQuantum committed Jan 1, 2025
1 parent a40a854 commit 613498d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Inventory.zig
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ pub const Sync = struct { // MARK: Sync
for(inv._items, 0..) |invStack, slot| {
if(std.meta.eql(invStack.item, itemStack.item)) {
const amount = @min(itemStack.item.?.stackSize() - invStack.amount, itemStack.amount);
if(amount == 0) continue;
executeCommand(.{.fillFromCreative = .{.dest = .{.inv = inv, .slot = @intCast(slot)}, .item = itemStack.item, .amount = invStack.amount + amount}}, null);
itemStack.amount -= amount;
if(itemStack.amount == 0) break :outer;
Expand Down

0 comments on commit 613498d

Please sign in to comment.