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

Commit

Permalink
fix OC behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
GDCloudstrike committed Feb 10, 2024
1 parent 5deb346 commit 3a08972
Showing 1 changed file with 15 additions and 9 deletions.
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

0 comments on commit 3a08972

Please sign in to comment.