Skip to content

Commit

Permalink
Fix #143: Battery dupe when inserting in ender cell (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
Technici4n authored Aug 3, 2024
1 parent 330eb52 commit fe0fde0
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate

if (!simulate) {
if (existing.isEmpty()) {
this.stacks.set(slot, reachedLimit ? ItemStackHandlerHelper.copyStackWithSize(stack, limit) : stack);
// We must always copy the stack because onContentsChanged might change it, messing with our later use.
this.stacks.set(slot, reachedLimit ? ItemStackHandlerHelper.copyStackWithSize(stack, limit) : stack.copy());
} else {
existing.grow(reachedLimit ? limit : stack.getCount());
}
Expand Down

0 comments on commit fe0fde0

Please sign in to comment.