Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow limited multiamp on HILE #3832

Merged
merged 3 commits into from
Jan 20, 2025
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 @@ -55,6 +55,7 @@
import gregtech.api.util.GTRecipe;
import gregtech.api.util.GTUtility;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.OverclockCalculator;
import gregtech.common.blocks.BlockCasings10;
import gregtech.common.tileentities.render.TileEntityLaser;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
Expand All @@ -76,7 +77,7 @@ public class MTEIndustrialLaserEngraver extends MTEExtendedPowerMultiBlockBase<M
.addElement(
'a',
buildHatchAdder(MTEIndustrialLaserEngraver.class)
.atLeast(InputBus, OutputBus, InputHatch, OutputHatch, Maintenance, Energy)
.atLeast(InputBus, OutputBus, InputHatch, OutputHatch, Maintenance, Energy, ExoticEnergy)
.casingIndex(((BlockCasings10) GregTechAPI.sBlockCasings10).getTextureIndex(1))
.dot(1)
.buildAndChain(
Expand Down Expand Up @@ -238,7 +239,8 @@ protected MultiblockTooltipBuilder createTooltip() {
.addInfo("250% faster than single block machines of the same voltage")
.addInfo("Uses 80% of the EU normally required")
.addInfo("Laser source hatch determines maximum recipe tier and parallels")
.addInfo("Can perform recipes up to laser source tier + 1")
.addInfo("Recipe tier and overclocks limited to laser source tier + 1")
.addInfo("With UEV laser source, 1 multi-amp energy hatch is allowed (instead of regular hatches)")
.addInfo("Parallels equal to the cube root of laser source amperage input")
.addInfo("Glass tier determines maximum laser source tier")
.addInfo("UMV glass accepts all laser source hatches")
Expand Down Expand Up @@ -301,6 +303,16 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a
if (mCasingAmount < 35) return false;
if (laserSource == null) return false;
if (!findLaserRenderer(base.getWorld(), base.getXCoord(), base.getYCoord(), base.getZCoord())) return false;

// If there are exotic hatches, ensure there is only 1, and it is not laser. Only multiamp allowed
if (!mExoticEnergyHatches.isEmpty()) {
if (laserSource.mTier < VoltageIndex.UEV) return false;
if (!mEnergyHatches.isEmpty()) return false;
if (mExoticEnergyHatches.size() > 1) return false;
return mExoticEnergyHatches.get(0)
.maxWorkingAmperesIn() <= 64;
}

return glassTier >= VoltageIndex.UMV || laserSource.mTier <= glassTier;
}

Expand Down Expand Up @@ -341,6 +353,15 @@ protected CheckRecipeResult onRecipeStart(@NotNull GTRecipe recipe) {
return super.onRecipeStart(recipe);
}

@NotNull
@Override
protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe) {
// Limit ocs up to hatch tier + 1
int ocs = (laserSource.mTier + 1) - GTUtility.getTier(recipe.mEUt);
if (ocs < 0) ocs = 0;
return super.createOverclockCalculator(recipe).limitOverclockCount(ocs);
}

@Override
public ProcessingLogic clear() {
if (renderer != null) renderer.setShouldRender(false);
Expand Down Expand Up @@ -407,8 +428,10 @@ public boolean supportsSingleRecipeLocking() {

@Override
protected void setProcessingLogicPower(ProcessingLogic logic) {
logic.setAvailableVoltage(GTUtility.roundUpVoltage(this.getMaxInputVoltage()));
logic.setAvailableAmperage(1L);
if (mExoticEnergyHatches.isEmpty()) {
logic.setAvailableVoltage(GTUtility.roundUpVoltage(this.getMaxInputVoltage()));
logic.setAvailableAmperage(1L);
} else super.setProcessingLogicPower(logic);
}

@Override
Expand Down
Loading