Skip to content

Commit

Permalink
feat: Make item push rate much higher (experiment)
Browse files Browse the repository at this point in the history
Now pushes an entire stack out of at most one slot each time we transfer items.
This could be improved to push the entire inventory each time we push, but I want to seek feedback on this change first.
  • Loading branch information
Rover656 committed Jan 8, 2025
1 parent 236448a commit a976d7e
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public static void distributeItems(boolean canPush, boolean canPull, IItemHandle

private static void moveItems(IItemHandler from, IItemHandler to) {
for (int i = 0; i < from.getSlots(); i++) {
ItemStack extracted = from.extractItem(i, 1, true);
ItemStack extracted = from.extractItem(i, from.getSlotLimit(i), true);
if (!extracted.isEmpty()) {
for (int j = 0; j < to.getSlots(); j++) {
ItemStack inserted = to.insertItem(j, extracted, false);
if (inserted.isEmpty()) {
from.extractItem(i, 1, false);
return;
from.extractItem(i, extracted.getCount(), false);
return; // TODO: possibly do all slots?
}
}
}
Expand All @@ -44,6 +44,7 @@ private static void moveItems(IItemHandler from, IItemHandler to) {

// region Fluids

// TODO: Possibly raise this too?
public static final int DEFAULT_FLUID_DRAIN = 100;

public static void distributeFluids(IOMode mode, IFluidHandler selfItemHandler, IFluidHandler otherItemHandler) {
Expand Down

0 comments on commit a976d7e

Please sign in to comment.