|
| 1 | +package sunsetsatellite.catalyst.energy.improved.electric.api; |
| 2 | + |
| 3 | +import org.jetbrains.annotations.NotNull; |
| 4 | +import sunsetsatellite.catalyst.core.util.Direction; |
| 5 | + |
| 6 | +public interface IElectric { |
| 7 | + /** |
| 8 | + * @param dir Direction to check |
| 9 | + * @return <code>true</code> if container can receive energy from <code>dir</code>, <code>false</code> otherwise |
| 10 | + */ |
| 11 | + boolean canReceive(@NotNull Direction dir); |
| 12 | + /** |
| 13 | + * @param dir Direction to check |
| 14 | + * @return <code>true</code> if container can provide energy to <code>dir</code>, <code>false</code> otherwise |
| 15 | + */ |
| 16 | + default boolean canProvide(@NotNull Direction dir) { return false; } |
| 17 | + |
| 18 | + /** |
| 19 | + * @return Amount of energy currently available in container |
| 20 | + */ |
| 21 | + long getEnergy(); |
| 22 | + /** |
| 23 | + * @return Maximum energy capacity of the container. |
| 24 | + */ |
| 25 | + long getCapacity(); |
| 26 | + |
| 27 | + /** |
| 28 | + * @return Amount of unused capacity left |
| 29 | + */ |
| 30 | + default long getCapacityRemaining() { |
| 31 | + return getCapacity() - getEnergy(); |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * @return Maximum voltage this container can handle |
| 36 | + */ |
| 37 | + long getMaxInputVoltage(); |
| 38 | + |
| 39 | + /** |
| 40 | + * @return Maximum amount of amps this machine can use |
| 41 | + */ |
| 42 | + long getMaxInputAmperage(); |
| 43 | + |
| 44 | + /** |
| 45 | + * @return Maximum voltage this container can maintain |
| 46 | + */ |
| 47 | + long getMaxOutputVoltage(); |
| 48 | + |
| 49 | + /** |
| 50 | + * @return Maximum amperage this container can deliver |
| 51 | + */ |
| 52 | + long getMaxOutputAmperage(); |
| 53 | + |
| 54 | + /** |
| 55 | + * Changes energy amount in container. |
| 56 | + * @param difference Amount of energy changed, will remove energy if negative |
| 57 | + * @return Amount of energy actually changed. |
| 58 | + */ |
| 59 | + long internalChangeEnergy(long difference); |
| 60 | + |
| 61 | + /** |
| 62 | + * Adds energy to container. |
| 63 | + * @param energy Amount of energy to be added |
| 64 | + * @return Amount of energy actually added |
| 65 | + */ |
| 66 | + default long internalAddEnergy(long energy) { |
| 67 | + return internalChangeEnergy(energy); |
| 68 | + } |
| 69 | + |
| 70 | + /** |
| 71 | + * Removes energy from the container. |
| 72 | + * @param energy Amount of energy to be removed |
| 73 | + * @return Amount of energy actually removed |
| 74 | + */ |
| 75 | + default long internalRemoveEnergy(long energy) { |
| 76 | + return internalChangeEnergy(-energy); |
| 77 | + } |
| 78 | + |
| 79 | + /** |
| 80 | + * @return Amperage currently being used |
| 81 | + */ |
| 82 | + long getAmpsCurrentlyUsed(); |
| 83 | + |
| 84 | + void addAmpUsage(long amperage); |
| 85 | + |
| 86 | + /** |
| 87 | + * Only this method should be to pass energy in blocks, handles both voltage and amperage. |
| 88 | + * @param dir Direction of receive |
| 89 | + * @param amperage Receiving amperage |
| 90 | + * @return Amps used |
| 91 | + */ |
| 92 | + long receiveEnergy(@NotNull Direction dir, long amperage); |
| 93 | + |
| 94 | +} |
0 commit comments