Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
fixed mass storage not inserting from inventory when filter is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Jul 2, 2024
1 parent e9bbc37 commit eb50042
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,22 @@ public InteractionResult onInteractServer(BlockState state, Level world, BlockPo
if (leftover.getCount() < stack.getCount()) {
handler.insertItem(0, stack.copy(), false);
stack.shrink(stack.getCount() - leftover.getCount());
for (int i = 0; i < player.getInventory().items.size(); i++){
ItemStack stack1 = player.getInventory().items.get(i);
if (Utils.equals(stack1, displayed) || Utils.equals(stack1, stored)){
ItemStack inserted = handler.insertItem(0, stack1.copy(), false);
stack1.shrink(stack1.getCount() - inserted.getCount());
if (inserted.getCount() > 0) break;
}
}
return InteractionResult.SUCCESS;
}
} else {
if (!stored.isEmpty() || !displayed.isEmpty()) {
boolean sucess = false;
for (int i = 0; i < player.getInventory().items.size(); i++){
ItemStack stack1 = player.getInventory().items.get(i);
if (Utils.equals(stack1, displayed)){
if (Utils.equals(stack1, displayed) || Utils.equals(stack1, stored)){
ItemStack inserted = handler.insertItem(0, stack1.copy(), false);
stack1.shrink(stack1.getCount() - inserted.getCount());
sucess = true;
Expand Down

0 comments on commit eb50042

Please sign in to comment.