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

Commit

Permalink
fix missing OCs and code clean
Browse files Browse the repository at this point in the history
  • Loading branch information
HoleFish committed Mar 7, 2024
1 parent 83859f8 commit 6843a83
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,6 @@ public ITexture getTextureOverlay() {
return textureOverlay;
}

@Override
public int tierOverclock() {
return 1;
}

@Override
public String[] getStructureDescription(ItemStack stackSize) {
return DescTextLocalization.addText("LargeFusion1.hint", 9);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ public ITexture getTextureOverlay() {
return textureOverlay;
}

@Override
public int tierOverclock() {
return 2;
}

@Override
public String[] getStructureDescription(ItemStack stackSize) {
return DescTextLocalization.addText("LargeFusion2.hint", 9);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@ public ITexture getTextureOverlay() {
return textureOverlay;
}

@Override
public int tierOverclock() {
return 4;
}

@Override
public String[] getStructureDescription(ItemStack stackSize) {
return DescTextLocalization.addText("LargeFusion3.hint", 9);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,6 @@ public int getMaxPara() {
return 64;
}

@Override
public int tierOverclock() {
return 8;
}

@Override
public int extraPara(int startEnergy) {
if (startEnergy < 160000000) return 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,6 @@ public int getMaxPara() {
return 64;
}

@Override
public int tierOverclock() {
return 16;
}

@Override
public int extraPara(int startEnergy) {
if (startEnergy < 160000000) return 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import static gregtech.api.util.GT_StructureUtility.filterByMTETier;
import static gregtech.api.util.GT_StructureUtility.ofFrame;
import static gregtech.api.util.GT_Utility.filterValidMTEs;
import static gregtech.api.util.GT_Utility.roundUpVoltage;

import java.util.List;

Expand Down Expand Up @@ -409,27 +408,6 @@ public void onMachineBlockUpdate() {
mUpdate = 100;
}

public abstract int tierOverclock();

public int overclock(int mStartEnergy) {
if (tierOverclock() == 1) {
return 0;
}
if (tierOverclock() == 2) {
return mStartEnergy <= 160000000 ? 1 : 0;
}
if (tierOverclock() == 4) {
return (mStartEnergy <= 160000000 ? 2 : (mStartEnergy <= 320000000 ? 1 : 0));
}
if (tierOverclock() == 8) {
return (mStartEnergy <= 160000000) ? 3
: ((mStartEnergy <= 320000000) ? 2 : (mStartEnergy <= 640000000) ? 1 : 0);
}
return (mStartEnergy <= 160000000) ? 4
: ((mStartEnergy <= 320000000) ? 3
: ((mStartEnergy <= 640000000) ? 2 : (mStartEnergy <= 1280000000) ? 1 : 0));
}

@Override
public RecipeMap<?> getRecipeMap() {
return RecipeMaps.fusionRecipes;
Expand All @@ -454,19 +432,19 @@ protected GT_ParallelHelper createParallelHelper(@NotNull GT_Recipe recipe) {
@NotNull
@Override
protected GT_OverclockCalculator createOverclockCalculator(@NotNull GT_Recipe recipe) {
int overclockCount = overclock(recipe.mSpecialValue);
if (GT_Values.VP[LargeFusionComputer.this.tier()] <= roundUpVoltage(recipe.mEUt)) {
overclockCount = 0;
}
return super.createOverclockCalculator(recipe).limitOverclockCount(overclockCount);
return overclockDescriber.createCalculator(super.createOverclockCalculator(recipe), recipe);
}

@NotNull
@Override
protected CheckRecipeResult validateRecipe(@NotNull GT_Recipe recipe) {
if (!mRunningOnLoad && recipe.mSpecialValue > maxEUStore()
|| GT_Values.VP[LargeFusionComputer.this.tier()] < recipe.mEUt) {
return CheckRecipeResultRegistry.insufficientStartupPower(recipe.mSpecialValue);
if (!mRunningOnLoad) {
if (recipe.mSpecialValue > maxEUStore()) {
return CheckRecipeResultRegistry.insufficientStartupPower(recipe.mSpecialValue);
}
if (recipe.mEUt > GT_Values.V[tier()]) {
return CheckRecipeResultRegistry.insufficientPower(recipe.mEUt);
}
}
maxParallel = getMaxPara() * extraPara(recipe.mSpecialValue);
return CheckRecipeResultRegistry.SUCCESSFUL;
Expand All @@ -486,14 +464,13 @@ public CheckRecipeResult process() {
para = getCurrentParallels();
return result;
}
}.setOverclock(1, 1);
};
}

@Override
protected void setProcessingLogicPower(ProcessingLogic logic) {
logic.setAvailableVoltage(GT_Values.V[hatchTier()]);
logic.setAvailableAmperage(
getSingleHatchPower() * (mEnergyHatches.size() + eEnergyMulti.size()) / GT_Values.V[hatchTier()]);
logic.setAvailableVoltage(GT_Values.V[tier()]);
logic.setAvailableAmperage(getSingleHatchPower() * 32 / GT_Values.V[tier()]);
}

@Override
Expand Down Expand Up @@ -553,11 +530,6 @@ public IStructureDefinition<LargeFusionComputer> getStructure_EM() {
return STRUCTURE_DEFINITION.get(getClass());
}

@Override
public boolean isGivingInformation() {
return true;
}

@Override
public int getMaxEfficiency(ItemStack aStack) {
return 10000;
Expand All @@ -581,7 +553,7 @@ protected ResourceLocation getActivitySound() {
@Override
public String[] getInfoData() {
IGregTechTileEntity baseMetaTileEntity = getBaseMetaTileEntity();
String tier = switch (hatchTier()) {
String tier = switch (tier()) {
case 6 -> EnumChatFormatting.RED + "I" + EnumChatFormatting.RESET;
case 7 -> EnumChatFormatting.RED + "II" + EnumChatFormatting.RESET;
case 8 -> EnumChatFormatting.RED + "III" + EnumChatFormatting.RESET;
Expand Down

0 comments on commit 6843a83

Please sign in to comment.