blob: 4903d7fa231c99fbce34882d7c9235372794bb63 (
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
|
package gregtech.api.logic.interfaces;
import java.util.Objects;
import javax.annotation.Nonnull;
import net.minecraftforge.common.util.ForgeDirection;
import gregtech.api.interfaces.tileentity.IEnergyConnected;
import gregtech.api.logic.PowerLogic;
/**
* Power logic class for one to use to enable a machine to use energy
*/
public interface PowerLogicHost {
/**
*
* @param side Side being access to try and get the power logic from
* @return Can return NullPowerLogic if the side doesn't allow the return of the logic. That power logic is unusable
*/
@Nonnull
PowerLogic getPowerLogic(@Nonnull ForgeDirection side);
/**
* Gives the power logic ignoring the side.
*/
@Nonnull
default PowerLogic getPowerLogic() {
return Objects.requireNonNull(getPowerLogic(ForgeDirection.UNKNOWN));
}
/**
* Shortcut to the method of {@link PowerLogic#isEnergyReceiver()}
*/
default boolean isEnergyReceiver() {
return getPowerLogic().isEnergyReceiver();
}
/**
* Shortcut to the method of {@link PowerLogic#isEnergyEmitter()}
*/
default boolean isEnergyEmitter() {
return getPowerLogic().isEnergyEmitter();
}
/**
* Method for emitting energy to other blocks and machines. Override when it needs to be changed.
*/
default void emitEnergyFromLogic() {
IEnergyConnected.Util.emitEnergyToNetwork(this, getPowerOutputSide());
}
/**
* From where does the machine output energy from?
* When the output side is {@link ForgeDirection#UNKNOWN} then it won't output energy
*/
@Nonnull
ForgeDirection getPowerOutputSide();
}
|