mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-19 19:49:50 +00:00
Updates for changed IC2 API. Not sure if I'll be able to use @Optional with the new non-legacy BC MJ API as it uses Annotations instead of interfaces.
This commit is contained in:
1 parent
5e0dc25e2b
commit
cd10bc88c8
14 files changed
+126
-34
No files matched your search
@@ -0,0 +1,18 @@
|
||||
package ic2.api.energy;
|
||||
|
||||
|
||||
/**
|
||||
* Provides access to the energy network.
|
||||
*
|
||||
* The old EnergyNet methods missing in IEnergyNet have been migrated to events (load, unload) or
|
||||
* removed (tiles no longer emit energy actively, the energy net implementation requests it).
|
||||
*
|
||||
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
|
||||
*/
|
||||
public final class EnergyNet {
|
||||
/**
|
||||
* Instance of the global EnergyNet class.
|
||||
*/
|
||||
public static IEnergyNet instance;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package ic2.api.energy;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Interface representing the methods provided by the global EnergyNet class.
|
||||
*
|
||||
* See ic2/api/energy/usage.txt for an overall description of the energy net api.
|
||||
*/
|
||||
public interface IEnergyNet {
|
||||
/**
|
||||
* Get the EnergyNet-registered tile entity at the specified position.
|
||||
*
|
||||
* This is not the same as World.getTileEntity(), it's possible to register delegate tile
|
||||
* entities with the energy net which are different from what's actually in the world. Those
|
||||
* delegates allow to use separate TileEntity objects just for the EnergyNet interfaces,
|
||||
* simplifying cross-mod dependencies and multi-blocks.
|
||||
*
|
||||
* @param world World containing the tile entity
|
||||
* @param x x-coordinate
|
||||
* @param y y-coordinate
|
||||
* @param z z-coordinate
|
||||
* @return tile entity registered to the energy net or null if none is registered
|
||||
*/
|
||||
TileEntity getTileEntity(World world, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Get the EnergyNet-registered neighbor tile entity at the specified position.
|
||||
*
|
||||
* @param te TileEntity indicating the world and position to search from
|
||||
* @param dir direction the neighbor is to be found
|
||||
* @return neighbor tile entity registered to the energy net or null if none is registered
|
||||
*/
|
||||
TileEntity getNeighbor(TileEntity te, ForgeDirection dir);
|
||||
|
||||
/**
|
||||
* determine how much energy has been emitted by the EnergyEmitter specified
|
||||
*
|
||||
* @note call this twice with x ticks delay to get the avg. emitted power p = (call2 - call1) / x EU/tick
|
||||
*
|
||||
* @param tileEntity energy emitter
|
||||
*/
|
||||
double getTotalEnergyEmitted(TileEntity tileEntity);
|
||||
|
||||
/**
|
||||
* determine how much energy has been sunken by the EnergySink specified
|
||||
*
|
||||
* @note call this twice with x ticks delay to get the avg. sunken power p = (call2 - call1) / x EU/tick
|
||||
*
|
||||
* @param tileEntity energy emitter
|
||||
*/
|
||||
double getTotalEnergySunken(TileEntity tileEntity);
|
||||
|
||||
/**
|
||||
* Determine the typical power used by the specific tier, e.g. 128 eu/t for tier 2.
|
||||
*
|
||||
* @param tier tier
|
||||
* @return power in eu/t
|
||||
*/
|
||||
double getPowerFromTier(int tier);
|
||||
|
||||
/**
|
||||
* Determine minimum tier required to handle the specified power, e.g. tier 2 for 128 eu/t.
|
||||
*
|
||||
* @param power in eu/t
|
||||
* @return tier
|
||||
*/
|
||||
int getTierFromPower(double power);
|
||||
}
|
||||
Reference in new issue
Block a user