From f6b840fa3fb6f0238617b992d074ffc7b779b5e5 Mon Sep 17 00:00:00 2001 From: Ghzdude <44148655+ghzdude@users.noreply.github.com> Date: Fri, 5 Apr 2024 23:46:21 -0700 Subject: [PATCH] dual handler probably works now --- src/main/java/gregtech/api/DualHandler.java | 7 ++++--- .../gregtech/api/capability/impl/AbstractRecipeLogic.java | 7 ++++++- .../multiblock/RecipeMapMultiblockController.java | 1 - src/main/java/gregtech/api/recipes/Recipe.java | 2 -- src/main/java/gregtech/api/recipes/RecipeMap.java | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/gregtech/api/DualHandler.java b/src/main/java/gregtech/api/DualHandler.java index 95d7d15dc3d..0c975034b85 100644 --- a/src/main/java/gregtech/api/DualHandler.java +++ b/src/main/java/gregtech/api/DualHandler.java @@ -9,7 +9,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.items.IItemHandlerModifiable; @@ -29,11 +28,13 @@ public final class DualHandler implements IItemHandlerModifiable, IMultipleTankH @Nullable IDirtyNotifiable dirtyNotifiable; private final boolean isExport; - private static final MultiFluidTankEntry EMPTY = new MultiFluidTankEntry(new FluidTankList(false, new FluidTank[0]), new FluidTank(0)); + private static final MultiFluidTankEntry EMPTY = new MultiFluidTankEntry(new FluidTankList(false, new FluidTank[0]), + new FluidTank(0)); private final List notifiables = new ArrayList<>(); - public DualHandler(IItemHandlerModifiable itemDelegate, IMultipleTankHandler fluidDelegate, IDirtyNotifiable notifiable, + public DualHandler(IItemHandlerModifiable itemDelegate, IMultipleTankHandler fluidDelegate, + IDirtyNotifiable notifiable, boolean isExport) { this.itemDelegate = itemDelegate; this.fluidDelegate = fluidDelegate; diff --git a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java index 6d8877ff1dc..589a79656d5 100644 --- a/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java +++ b/src/main/java/gregtech/api/capability/impl/AbstractRecipeLogic.java @@ -1,5 +1,6 @@ package gregtech.api.capability.impl; +import gregtech.api.DualHandler; import gregtech.api.GTValues; import gregtech.api.capability.GregtechDataCodes; import gregtech.api.capability.GregtechTileCapabilities; @@ -547,7 +548,11 @@ protected Recipe findRecipe(long maxVoltage, IItemHandlerModifiable inputs, IMul return null; } - return map.findRecipe(maxVoltage, inputs, fluidInputs); + if (inputs instanceof DualHandler dualHandler) { + return map.findRecipe(maxVoltage, dualHandler, dualHandler); + } else { + return map.findRecipe(maxVoltage, inputs, fluidInputs); + } } /** diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java index d108498f22c..0195e5f6589 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java @@ -1,6 +1,5 @@ package gregtech.api.metatileentity.multiblock; -import gregtech.api.DualHandler; import gregtech.api.GTValues; import gregtech.api.capability.IDistinctBusController; import gregtech.api.capability.IEnergyContainer; diff --git a/src/main/java/gregtech/api/recipes/Recipe.java b/src/main/java/gregtech/api/recipes/Recipe.java index 46c3d6ae896..c4d0ef3e438 100644 --- a/src/main/java/gregtech/api/recipes/Recipe.java +++ b/src/main/java/gregtech/api/recipes/Recipe.java @@ -1,6 +1,5 @@ package gregtech.api.recipes; -import gregtech.api.DualHandler; import gregtech.api.capability.IMultipleTankHandler; import gregtech.api.capability.impl.FluidTankList; import gregtech.api.recipes.category.GTRecipeCategory; @@ -21,7 +20,6 @@ import net.minecraft.util.NonNullList; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidTank; -import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.oredict.OreDictionary; diff --git a/src/main/java/gregtech/api/recipes/RecipeMap.java b/src/main/java/gregtech/api/recipes/RecipeMap.java index 9743c549ae5..a0086831503 100644 --- a/src/main/java/gregtech/api/recipes/RecipeMap.java +++ b/src/main/java/gregtech/api/recipes/RecipeMap.java @@ -534,7 +534,7 @@ amount, getMaxFluidOutputs()), @Nullable public Recipe findRecipe(long voltage, IItemHandlerModifiable inputs, IMultipleTankHandler fluidInputs) { - return this.findRecipe(voltage, GTUtility.itemHandlerToList(inputs), GTUtility.fluidHandlerToList(fluidInputs)); + return findRecipe(voltage, GTUtility.itemHandlerToList(inputs), GTUtility.fluidHandlerToList(fluidInputs)); } /**