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

Commit

Permalink
Fix LFTR (#832)
Browse files Browse the repository at this point in the history
* Fix hatch

* fix fuel search

* spotless
  • Loading branch information
HoleFish authored Feb 10, 2024
1 parent 7ab7a3b commit 60a3c0d
Showing 1 changed file with 33 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected GT_Multiblock_Tooltip_Builder createTooltip() {
.addDynamoHatch("Top or bottom layer edges", 1).addMaintenanceHatch("Top or bottom layer edges", 1)
.addMufflerHatch("Top 3x3", 2).addStructureInfo("All dynamos must be between EV and LuV tier.")
.addStructureInfo("All other hatches must be IV+ tier.")
.addStructureInfo("4x Output Hatches, 2x Input Hatches, 4x Dynamo Hatches")
.addStructureInfo("4x Output Hatches or 1x Output Hatch (ME), 1+ Input Hatches, 4x Dynamo Hatches")
.addStructureInfo("2x Maintenance Hatches, 4x Mufflers").toolTipFinisher(CORE.GT_Tooltip_Builder.get());
return tt;
}
Expand Down Expand Up @@ -156,17 +156,17 @@ public final boolean addNuclearReactorEdgeList(IGregTechTileEntity aTileEntity,
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
} else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo
&& (((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity).mTier >= 4
&& ((GT_MetaTileEntity_Hatch_Dynamo) aMetaTileEntity).mTier <= 6)) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
} else
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input
&& ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mTier >= 5) {
} else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo dynamo
&& dynamo.getTierForStructure() >= 4
&& dynamo.getTierForStructure() <= 6) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
} else
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input hatch
&& hatch.getTierForStructure() >= 5) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
} else
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output
&& ((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity).mTier >= 5) {
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output hatch
&& hatch.getTierForStructure() >= 5) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
}
Expand All @@ -178,8 +178,7 @@ public final boolean addNuclearReactorTopList(IGregTechTileEntity aTileEntity, i
return false;
} else {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler
&& ((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity).mTier >= 5) {
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler hatch && hatch.getTierForStructure() >= 5) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
}
Expand Down Expand Up @@ -239,16 +238,11 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBu
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
mCasing = 0;
if (checkPiece(mName, 3, 3, 0) && mCasing >= 27) {
if (mOutputHatches.size() >= 3 && mInputHatches.size() >= 2
if ((mOutputHatches.size() >= 3 || canDumpFluidToME()) && mInputHatches.size() >= 1
&& mDynamoHatches.size() == 4
&& mMufflerHatches.size() == 4
&& mMaintenanceHatches.size() == 2) {
this.mWrench = true;
this.mScrewdriver = true;
this.mSoftHammer = true;
this.mHardHammer = true;
this.mSolderingTool = true;
this.mCrowbar = true;
fixAllMaintenanceIssue();
this.turnCasingActive(false);
return true;
}
Expand Down Expand Up @@ -328,27 +322,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 @@ -372,15 +345,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 60a3c0d

Please sign in to comment.