Started work on new power api
This commit is contained in:
parent
926bcb9f8b
commit
4fae706242
15 changed files with 739 additions and 0 deletions
90
src/main/java/techreborn/api/power/IEnergyInterfaceTile.java
Normal file
90
src/main/java/techreborn/api/power/IEnergyInterfaceTile.java
Normal file
|
@ -0,0 +1,90 @@
|
|||
package techreborn.api.power;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IEnergyInterfaceTile {
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Amount of energy in the tile
|
||||
*/
|
||||
public int getEnergy();
|
||||
|
||||
/**
|
||||
* Sets the energy in the tile
|
||||
*
|
||||
* @param energy the amount of energy to set.
|
||||
*/
|
||||
public void setEnergy(int energy);
|
||||
|
||||
/**
|
||||
* Gets the max stored energy in the tile
|
||||
* @return The max energy
|
||||
*/
|
||||
public int getMaxPower();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param energy amount of energy to add to the tile
|
||||
*
|
||||
* @return will return true if can fit all
|
||||
*/
|
||||
public boolean canAddEnergy(int energy);
|
||||
|
||||
/**
|
||||
*
|
||||
* Will try add add the full amount of energy.
|
||||
*
|
||||
* @param energy amount to add
|
||||
*
|
||||
* @return The amount of energy that was added.
|
||||
*/
|
||||
public int addEnergy(int energy);
|
||||
|
||||
/**
|
||||
* Returns true if it can use the full amount of energy
|
||||
*
|
||||
* @param energy amount of energy to use from the tile.
|
||||
*
|
||||
* @return if all the energy can be used.
|
||||
*/
|
||||
public boolean canUseEnergy(int energy);
|
||||
|
||||
/**
|
||||
* Will try and use the full amount of energy
|
||||
*
|
||||
* @param energy energy to use
|
||||
*
|
||||
* @return if the energy was used
|
||||
*/
|
||||
public boolean useEnergy(int energy);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param direction The direction to insert energy into
|
||||
*
|
||||
* @return if the tile can accept energy from the direction
|
||||
*/
|
||||
public boolean canAcceptEnergy(ForgeDirection direction);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param direction The direction to provide energy from
|
||||
* @return
|
||||
*/
|
||||
public boolean canProvideEnergy(ForgeDirection direction);
|
||||
|
||||
/**
|
||||
* Gets the max output, set to -1 if you don't want the tile to provide energy
|
||||
*
|
||||
* @return the max amount of energy outputted per tick.
|
||||
*/
|
||||
public int getMaxOutput();
|
||||
|
||||
/**
|
||||
* Return -1 if you don't want to accept power ever.
|
||||
*
|
||||
* @return The max amount of energy that can be added to the tile in one tick.
|
||||
*/
|
||||
public int getMaxInput();
|
||||
}
|
8
src/main/java/techreborn/powerSystem/PowerSystem.java
Normal file
8
src/main/java/techreborn/powerSystem/PowerSystem.java
Normal file
|
@ -0,0 +1,8 @@
|
|||
package techreborn.powerSystem;
|
||||
|
||||
public class PowerSystem {
|
||||
|
||||
public static boolean RFPOWENET = true;
|
||||
|
||||
public static boolean EUPOWENET = true;
|
||||
}
|
18
src/main/java/techreborn/powerSystem/TilePowerAcceptor.java
Normal file
18
src/main/java/techreborn/powerSystem/TilePowerAcceptor.java
Normal file
|
@ -0,0 +1,18 @@
|
|||
package techreborn.powerSystem;
|
||||
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import techreborn.api.power.IEnergyInterfaceTile;
|
||||
|
||||
|
||||
@Optional.Interface(iface="ic2.api.energy.tile.IEnergyTile", modid="IC2", striprefs=true)
|
||||
public abstract class TilePowerAcceptor implements IEnergyReceiver, IEnergyInterfaceTile, IEnergyTile {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue