aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/goodgenerator/blocks/tileEntity/base/LargeFusionComputerPP.java
blob: 7d87e6fdd13e81cd0e456f7dc473e70b33b0f074 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package goodgenerator.blocks.tileEntity.base;

import static net.minecraft.util.StatCollector.translateToLocal;

import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters;

import gregtech.api.objects.overclockdescriber.OverclockDescriber;
import gregtech.api.util.AdvancedFusionOverclockDescriber;

public abstract class LargeFusionComputerPP extends LargeFusionComputer {

    protected Parameters.Group.ParameterIn batchSetting;

    /** Name of the batch setting */
    private static final INameFunction<LargeFusionComputerPP> BATCH_SETTING_NAME = (base,
        p) -> translateToLocal("gt.blockmachines.LargeFusionComputerPP.cfgi.0"); // Batch size
    /** Status of the batch setting */
    private static final IStatusFunction<LargeFusionComputerPP> BATCH_STATUS = (base, p) -> LedStatus
        .fromLimitsInclusiveOuterBoundary(p.get(), 1, 0, 32, 128);

    public LargeFusionComputerPP(String name) {
        super(name);
    }

    public LargeFusionComputerPP(int id, String name, String nameRegional) {
        super(id, name, nameRegional);
    }

    @Override
    protected OverclockDescriber createOverclockDescriber() {
        return new AdvancedFusionOverclockDescriber((byte) tier(), capableStartupCanonical());
    }

    @Override
    protected void parametersInstantiation_EM() {
        batchSetting = parametrization.getGroup(9, false)
            .makeInParameter(1, 1, BATCH_SETTING_NAME, BATCH_STATUS);
    }

    @Override
    protected int getMaxBatchSize() {
        // Batch size 1~128
        return (int) Math.min(Math.max(batchSetting.get(), 1.0D), 128.0D);
    }

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