Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Commit

Permalink
fix fuel search
Browse files Browse the repository at this point in the history
  • Loading branch information
HoleFish committed Feb 5, 2024
1 parent a122e16 commit e89e23f
Showing 1 changed file with 20 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,27 +323,6 @@ public boolean turnCasingActive(final boolean status) {
return true;
}

public int getStoredFuel(GT_Recipe aRecipe) {
int aFuelStored = 0;
FluidStack aFuelFluid = null;
for (FluidStack aFluidInput : aRecipe.mFluidInputs) {
if (!aFluidInput.getFluid().equals(NUCLIDE.Li2BeF4.getFluid())) {
aFuelFluid = aFluidInput;
break;
}
}
if (aFuelFluid != null) {
for (GT_MetaTileEntity_Hatch_Input aInputHatch : this.mInputHatches) {
if (aInputHatch.getFluid() != null && aInputHatch.getFluidAmount() > 0) {
if (aInputHatch.getFluid().isFluidEqual(aFuelFluid)) {
aFuelStored += aInputHatch.getFluidAmount();
}
}
}
}
return aFuelStored;
}

@Override
protected ProcessingLogic createProcessingLogic() {
return new ProcessingLogic() {
Expand All @@ -367,15 +346,29 @@ public CheckRecipeResult process() {
@NotNull
@Override
protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) {
mFuelRemaining = getStoredFuel(recipe);
mFuelRemaining = 0;
int li2bef4 = 0;
FluidStack aFuelFluid = null;
for (FluidStack aFluidInput : recipe.mFluidInputs) {
if (!aFluidInput.getFluid().equals(NUCLIDE.Li2BeF4.getFluid())) {
aFuelFluid = aFluidInput;
break;
}
}
if (aFuelFluid != null) {
for (FluidStack fluidStack : getStoredFluids()) {
if (fluidStack.isFluidEqual(aFuelFluid)) {
mFuelRemaining += fluidStack.amount;
} else if (fluidStack.getFluid().equals(NUCLIDE.Li2BeF4.getFluid())) {
li2bef4 += fluidStack.amount;
}
}
}
if (mFuelRemaining < 100) {
return CheckRecipeResultRegistry.NO_FUEL_FOUND;
}
for (GT_MetaTileEntity_Hatch_Input aInputHatch : mInputHatches) {
if (aInputHatch.getFluid().getFluid().equals(NUCLIDE.Li2BeF4.getFluid())
&& aInputHatch.getFluidAmount() < 200) {
return SimpleCheckRecipeResult.ofFailure("no_li2bef4");
}
if (li2bef4 < 200) {
return SimpleCheckRecipeResult.ofFailure("no_li2bef4");
}
return CheckRecipeResultRegistry.SUCCESSFUL;
}
Expand Down

0 comments on commit e89e23f

Please sign in to comment.