-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Continuous Recipe for Multiblock (#41)
* Create Continuous Multiblock logic * Finish Continuous Multiblock recipe and convert Fluidized bed reactor to use it
- Loading branch information
Showing
3 changed files
with
42 additions
and
6 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/main/java/supersymmetry/api/capability/impl/ContinuousMultiblockRecipeLogic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package supersymmetry.api.capability.impl; | ||
|
||
import gregtech.api.capability.impl.MultiblockRecipeLogic; | ||
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController; | ||
import gregtech.api.recipes.Recipe; | ||
import gregtech.api.util.GTUtility; | ||
|
||
public class ContinuousMultiblockRecipeLogic extends MultiblockRecipeLogic { | ||
public ContinuousMultiblockRecipeLogic(RecipeMapMultiblockController tileEntity) { | ||
super(tileEntity); | ||
} | ||
|
||
public ContinuousMultiblockRecipeLogic(RecipeMapMultiblockController tileEntity, boolean hasPerfectOC) { | ||
super(tileEntity, hasPerfectOC); | ||
} | ||
|
||
@Override | ||
protected boolean prepareRecipe(Recipe recipe) { | ||
recipe = Recipe.trimRecipeOutputs(recipe, this.getRecipeMap(), this.metaTileEntity.getItemOutputLimit(), this.metaTileEntity.getFluidOutputLimit()); | ||
|
||
int recipeTier = GTUtility.getTierByVoltage(recipe.getEUt()); | ||
int maximumTier = getOverclockForTier(getMaximumOverclockVoltage()); | ||
int numberOfOCs = maximumTier - recipeTier; | ||
double parallelLimitDouble = Math.pow(this.getOverclockingDurationDivisor(), numberOfOCs) / recipe.getDuration(); | ||
int parallelLimit = parallelLimitDouble <= 1 ? 1 : (int) parallelLimitDouble; | ||
|
||
recipe = findParallelRecipe(this, recipe, | ||
getInputInventory(), getInputTank(), | ||
getOutputInventory(), getOutputTank(), | ||
getMaxParallelVoltage(), parallelLimit); | ||
|
||
if (recipe != null && this.setupAndConsumeRecipeInputs(recipe, this.getInputInventory())) { | ||
this.setupRecipe(recipe); | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters