Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor FluidTankList and Filtered Handlers #2690

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix test
ghzdude committed Dec 27, 2024
commit c553531353d426b781536afa30700094909cc81b
Original file line number Diff line number Diff line change
@@ -84,6 +84,12 @@ public final int getIndexOfFluid(@Nullable FluidStack fluidStack) {
return -1;
}

public int simulateFill(FluidStack stack, int amount) {
var insertable = stack.copy();
insertable.amount = amount;
return fill(insertable, false);
}

@Override
public final @NotNull Iterator<Entry> iterator() {
return getFluidTanks().iterator();
4 changes: 2 additions & 2 deletions src/main/java/gregtech/api/recipes/logic/ParallelLogic.java
Original file line number Diff line number Diff line change
@@ -257,7 +257,7 @@ public static int limitParallelByItemsIncremental(@NotNull List<ItemStack> recip
* voiding products.
*/
public static int limitParallelByFluids(@NotNull Recipe recipe,
@NotNull MultipleTankHandler overlayedFluidHandler, int multiplier) {
@NotNull MultipleTankHandler tankHandler, int multiplier) {
int minMultiplier = 0;
int maxMultiplier = multiplier;

@@ -273,7 +273,7 @@ public static int limitParallelByFluids(@NotNull Recipe recipe,
} else {
amountLeft = fluidStack.amount * multiplier;
}
int inserted = overlayedFluidHandler.fill(fluidStack, false);
int inserted = tankHandler.simulateFill(fluidStack, amountLeft);
if (inserted > 0) {
amountLeft -= inserted;
}