From c84caa7cc1f1e5b3f7dce032c7fcb7d56980f6f7 Mon Sep 17 00:00:00 2001 From: Ghzdude <44148655+ghzdude@users.noreply.github.com> Date: Fri, 27 Dec 2024 01:12:22 -0700 Subject: [PATCH] remove unneeded method reorder parameters --- .../capability/impl/AbstractRecipeLogic.java | 4 +- .../gregtech/api/util/GTTransferUtils.java | 45 +++---------------- .../electric/MetaTileEntityFluidDrill.java | 4 +- 3 files changed, 10 insertions(+), 43 deletions(-) diff --git a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java index 57f0b7b20e9..632ae451b32 100644 --- a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java @@ -734,7 +734,7 @@ protected boolean checkOutputSpaceItems(@NotNull Recipe recipe, @NotNull IItemHa protected boolean checkOutputSpaceFluids(@NotNull Recipe recipe, @NotNull MultipleTankHandler exportFluids) { // We have already trimmed fluid outputs at this time if (!metaTileEntity.canVoidRecipeFluidOutputs() && - !GTTransferUtils.addFluidsToFluidHandler(exportFluids, true, recipe.getAllFluidOutputs())) { + !GTTransferUtils.addFluidsToFluidHandler(recipe.getAllFluidOutputs(), exportFluids, true)) { this.isOutputsFull = true; return false; } @@ -982,7 +982,7 @@ protected void completeRecipe() { */ protected void outputRecipeOutputs() { GTTransferUtils.addItemsToItemHandler(getOutputInventory(), false, itemOutputs); - GTTransferUtils.addFluidsToFluidHandler(getOutputTank(), false, fluidOutputs); + GTTransferUtils.addFluidsToFluidHandler(fluidOutputs, getOutputTank(), false); } /** diff --git a/src/main/java/gregtech/api/util/GTTransferUtils.java b/src/main/java/gregtech/api/util/GTTransferUtils.java index bcfea4b8948..651128764b8 100644 --- a/src/main/java/gregtech/api/util/GTTransferUtils.java +++ b/src/main/java/gregtech/api/util/GTTransferUtils.java @@ -134,40 +134,6 @@ public static boolean addItemsToItemHandler(final IItemHandler handler, return true; } - /** - * Simulates the insertion of fluid into a target fluid handler, then optionally performs the insertion. - *
- *
- * Simulating will not modify any of the input parameters. Insertion will either succeed completely, or fail - * without modifying anything. - * This method should be called with {@code simulate} {@code true} first, then {@code simulate} {@code false}, - * only if it returned {@code true}. - * - * @param fluidHandler the target inventory - * @param simulate whether to simulate ({@code true}) or actually perform the insertion ({@code false}) - * @param fluidStacks the items to insert into {@code fluidHandler}. - * @return {@code true} if the insertion succeeded, {@code false} otherwise. - */ - public static boolean addFluidsToFluidHandler(MultipleTankHandler fluidHandler, - boolean simulate, - List fluidStacks) { - if (simulate) { - // OverlayedFluidHandler overlayedFluidHandler = new OverlayedFluidHandler(fluidHandler); - for (FluidStack fluidStack : fluidStacks) { - int inserted = fluidHandler.fill(fluidStack, false); - if (inserted != fluidStack.amount) { - return false; - } - } - return true; - } - - for (FluidStack fluidStack : fluidStacks) { - fluidHandler.fill(fluidStack, true); - } - return true; - } - /** * Simulates the insertion of fluid into a target fluid handler, then optionally performs the insertion.
*
fluidStacks, - IFluidHandler fluidHandler, + public static boolean addFluidsToFluidHandler(List fluidStacks, + MultipleTankHandler fluidHandler, boolean simulate) { if (simulate) { - for (FluidStack stack : fluidStacks) { - int filled = fluidHandler.fill(stack, false); - if (filled < stack.amount) + for (FluidStack fluidStack : fluidStacks) { + int inserted = fluidHandler.fill(fluidStack, false); + if (inserted != fluidStack.amount) { return false; + } } return true; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java index 4e690124aaa..882d9e1acfd 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java @@ -287,8 +287,8 @@ public void setWorkingEnabled(boolean isActivationAllowed) { } public boolean fillTanks(FluidStack stack, boolean simulate) { - return GTTransferUtils.addFluidsToFluidHandler(outputFluidInventory, simulate, - Collections.singletonList(stack)); + return GTTransferUtils.addFluidsToFluidHandler(Collections.singletonList(stack), outputFluidInventory, + simulate); } public int getEnergyTier() {