aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces/tileentity/IBasicEnergyContainer.java
blob: 7b0bc9c69040e995472a9279cb7bf9650cad8356 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package gregtech.api.interfaces.tileentity;

/**
 * Interface for internal Code, which is mainly used for independent Energy conversion.
 */
public interface IBasicEnergyContainer extends IEnergyConnected {
    /**
     * Gets if that Amount of Energy is stored inside the Machine.
     * It is used for checking the contained Energy before consuming it.
     * If this returns false, it will also give a Message inside the Scanner, that this Machine doesn't have enough Energy.
     */
    boolean isUniversalEnergyStored(long aEnergyAmount);

    /**
     * Gets the stored electric, kinetic or steam Energy (with EU as reference Value)
     * Always returns the largest one.
     */
    long getUniversalEnergyStored();

    /**
     * Gets the largest electric, kinetic or steam Energy Capacity (with EU as reference Value)
     */
    long getUniversalEnergyCapacity();

    /**
     * Gets the amount of Energy Packets per tick.
     */
    long getOutputAmperage();

    /**
     * Gets the Output in EU/p.
     */
    long getOutputVoltage();

    /**
     * Gets the amount of Energy Packets per tick.
     */
    long getInputAmperage();

    /**
     * Gets the maximum Input in EU/p.
     */
    long getInputVoltage();

    /**
     * Decreases the Amount of stored universal Energy. If ignoring too less Energy, then it just sets the Energy to 0 and returns false.
     */
    boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy);

    /**
     * Increases the Amount of stored electric Energy. If ignoring too much Energy, then the Energy Limit is just being ignored.
     */
    boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy);

    /**
     * Drain Energy Call for Electricity.
     */
    boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage);

    /**
     * returns the amount of Electricity, accepted by this Block the last 5 ticks as Average.
     */
    long getAverageElectricInput();

    /**
     * returns the amount of Electricity, outputted by this Block the last 5 ticks as Average.
     */
    long getAverageElectricOutput();

    /**
     * returns the amount of electricity contained in this Block, in EU units!
     */
    long getStoredEU();

    /**
     * returns the amount of electricity containable in this Block, in EU units!
     */
    long getEUCapacity();

    /**
     * returns the amount of Steam contained in this Block, in EU units!
     */
    default long getStoredSteam() {
        return 0;
    }

    /**
     * returns the amount of Steam containable in this Block, in EU units!
     */
    default long getSteamCapacity() {
        return 0;
    }

    /**
     * Increases stored Energy. Energy Base Value is in EU, even though it's Steam!
     *
     * @param aEnergy              The Energy to add to the Machine.
     * @param aIgnoreTooMuchEnergy if it shall ignore if it has too much Energy.
     * @return if it was successful
     * <p/>
     * And yes, you can't directly decrease the Steam of a Machine. That is done by decreaseStoredEnergyUnits
     */
    default boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) {
        return false;
    }
}