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

Fix EIC recipe gating #391

Merged
merged 1 commit into from
Feb 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import java.util.ArrayList;
import java.util.List;

import javax.annotation.Nonnull;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
Expand Down Expand Up @@ -68,6 +70,8 @@
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_OverclockCalculator;
Expand Down Expand Up @@ -265,6 +269,17 @@ public RecipeMap<?> getRecipeMap() {
protected ProcessingLogic createProcessingLogic() {
return new ProcessingLogic() {

@NotNull
@Override
protected CheckRecipeResult validateRecipe(@Nonnull GT_Recipe recipe) {
long voltage = GT_TileEntity_ElectricImplosionCompressor.this.getAverageInputVoltage();
// Only allow a minimum of T-1 energy hatch
if (recipe.mEUt > voltage * 4) {
return CheckRecipeResultRegistry.insufficientPower(recipe.mEUt);
}
return CheckRecipeResultRegistry.SUCCESSFUL;
}

@NotNull
@Override
protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe) {
Expand All @@ -275,15 +290,6 @@ protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe re
}.setMaxParallelSupplier(() -> (int) Math.pow(4, Math.max(this.mBlockTier - 1, 0)));
}

@Override
protected void setProcessingLogicPower(ProcessingLogic logic) {
long amperage = this.getMaxInputAmps();
long voltage = this.getAverageInputVoltage();
// We allow one OC, if there is enough amperage, no matter which type of hatch is used
logic.setAvailableVoltage(amperage >= 4 ? voltage * 4 : voltage);
logic.setAvailableAmperage(amperage >= 4 ? amperage / 4 : amperage);
}

private void updateChunkCoordinates() {
this.chunkCoordinates.clear();

Expand Down