Skip to content

Commit

Permalink
dual handler probably works now
Browse files Browse the repository at this point in the history
  • Loading branch information
ghzdude committed Apr 6, 2024
1 parent daf03db commit f6b840f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/main/java/gregtech/api/DualHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<MetaTileEntity> 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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/gregtech/api/recipes/Recipe.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gregtech/api/recipes/RecipeMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down

0 comments on commit f6b840f

Please sign in to comment.