Power Advantage Lightweight API

Suppose you already have a tech mod that uses its own energy system (such as COFH redstone flux). Here's how you can easily make your mod's machines accept energy from Power Advantage:

@EventHandler
public void postInit(FMLPostInitializationEvent event) {
    if(Loader.isModLoaded("poweradvantage")){
        LightWeightPowerRegistry.registerLightWeightPowerAcceptor(Blocks.myMachine, 
                new ILightWeightPowerAcceptor(){
 
                    public boolean canAcceptEnergyType(ConduitType powerType) {
                        return ConduitType.areSameType(powerType, "electricity");
                    }
 
                    public float getEnergyDemand(TileEntity yourMachine,
                            ConduitType powerType) {
                        TileEntityMyMachine m = (TileEntityMyMachine)yourMachine;
                        return m.getMaxEnergyStored() - m.getEnergyStored();
                    }
 
                    public float addEnergy(TileEntity yourMachine,
                            float amountAdded, ConduitType powerType) {
                        TileEntityMyMachine m = (TileEntityMyMachine)yourMachine;
                        float actualChange = m.receiveEnergy(amountAdded);
                        return actualChange;
                    }
 
        });
    }
}

Power Types

The most common types of power in Power Advantage are "steam" and "electricity". Burning 1 coal item produces 1600 units of steam (1 per tick) or 50,000 units of electricity (16 per tick).

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License