Skip to content

Commit

Permalink
move back to gpl
Browse files Browse the repository at this point in the history
  • Loading branch information
purebluez committed Jan 27, 2025
1 parent 1e9e892 commit f72a63e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 41 deletions.
2 changes: 1 addition & 1 deletion src/main/java/gregtech/api/logic/ProcessingLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ private CalculationResult validateAndCalculateRecipe(@Nonnull GTRecipe recipe) {
* At this point, inputs have been already consumed.
*/
@Nonnull
private CheckRecipeResult applyRecipe(@Nonnull GTRecipe recipe, @Nonnull ParallelHelper helper,
protected CheckRecipeResult applyRecipe(@Nonnull GTRecipe recipe, @Nonnull ParallelHelper helper,
@Nonnull OverclockCalculator calculator, @Nonnull CheckRecipeResult result) {
if (recipe.mCanBeBuffered) {
lastRecipe = recipe;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTRecipe;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.OverclockCalculator;
import gregtech.api.util.ParallelHelper;
import gregtech.api.util.recipe.SolarFactoryRecipeData;

Expand All @@ -70,12 +71,6 @@ public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase<MTESolarFact
int casingTier;
boolean hasEnoughCasings;

ItemStack foundWaferStack;
int waferAmountInRecipe;
int foundWaferTier;
int minimumTierForRecipe;
boolean shouldMultiplyOutputs = true;

int outputMultiplierCap = 2;
double outputMultiplierSlope;

Expand Down Expand Up @@ -277,46 +272,18 @@ protected ItemStack[] calculateNewOutput(ItemStack currentOutput, int seed) {
return new ItemStack[] { copyAmountUnsafe(outputSize, currentOutput) };
}

private void clearVars() {
foundWaferStack = null;
waferAmountInRecipe = 0;
foundWaferTier = 0;
minimumTierForRecipe = 0;
shouldMultiplyOutputs = true;
}

@Override
public @NotNull CheckRecipeResult checkProcessing() {
setupProcessingLogic(processingLogic);

CheckRecipeResult result = doCheckRecipe();
result = postCheckRecipe(result, processingLogic);
// inputs are consumed at this point
updateSlots();
if (!result.wasSuccessful()) return result;

mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
mEfficiencyIncrease = 10000;
mMaxProgresstime = processingLogic.getDuration();
setEnergyUsage(processingLogic);

if (shouldMultiplyOutputs) {
mOutputItems = calculateNewOutput(
processingLogic.getOutputItems()[0],
(foundWaferTier - minimumTierForRecipe));
} else {
mOutputItems = processingLogic.getOutputItems();
}
mOutputFluids = processingLogic.getOutputFluids();

clearVars();
return result;
}

@Override
protected ProcessingLogic createProcessingLogic() {
return new ProcessingLogic() {

ItemStack foundWaferStack;
int waferAmountInRecipe;
int foundWaferTier;
int minimumTierForRecipe;
boolean shouldMultiplyOutputs = true;

private void findWaferStack() {
for (ItemStack items : inputItems) {
for (Pair<ItemStack, Integer> pair : validWafers) {
Expand All @@ -329,6 +296,27 @@ private void findWaferStack() {
}
}

private void clearVars() {
foundWaferStack = null;
waferAmountInRecipe = 0;
foundWaferTier = 0;
minimumTierForRecipe = 0;
shouldMultiplyOutputs = true;
}

@Override
protected @NotNull CheckRecipeResult applyRecipe(@NotNull GTRecipe recipe, @NotNull ParallelHelper helper,
@NotNull OverclockCalculator calculator, @NotNull CheckRecipeResult result) {
result = super.applyRecipe(recipe, helper, calculator, result);
if (shouldMultiplyOutputs) {
// We multiply outputs here since its after parallels are calculated, however this is after void
// protection checks so void protection is not supported.
outputItems = calculateNewOutput(outputItems[0], (foundWaferTier - minimumTierForRecipe));
}
clearVars();
return result;
}

@NotNull
@Override
public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) {
Expand Down

0 comments on commit f72a63e

Please sign in to comment.