Added IC2 integration.
This commit is contained in:
committed by
shartte
parent
623e9eea3c
commit
344958aefb
@@ -36,6 +36,8 @@ import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.networking.energy.IAEPowerStorage;
|
||||
import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType;
|
||||
import appeng.integration.modules.IC2;
|
||||
import appeng.integration.modules.ic2.IC2PowerSink;
|
||||
import appeng.tile.AEBaseInvTile;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
@@ -57,12 +59,16 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
|
||||
private final IEnergyStorage forgeEnergyAdapter;
|
||||
private Object teslaEnergyAdapter;
|
||||
|
||||
private IC2PowerSink ic2Sink;
|
||||
|
||||
public AERootPoweredTile()
|
||||
{
|
||||
forgeEnergyAdapter = new ForgeEnergyAdapter( this );
|
||||
if ( teslaConsumerCapability != null ) {
|
||||
teslaEnergyAdapter = new TeslaEnergyAdapter( this );
|
||||
}
|
||||
ic2Sink = IC2.createPowerSink(this);
|
||||
ic2Sink.setValidFaces( internalPowerSides );
|
||||
}
|
||||
|
||||
protected EnumSet<EnumFacing> getPowerSides()
|
||||
@@ -73,6 +79,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
|
||||
protected void setPowerSides( final EnumSet<EnumFacing> sides )
|
||||
{
|
||||
this.internalPowerSides = sides;
|
||||
ic2Sink.setValidFaces( sides );
|
||||
// trigger re-calc!
|
||||
}
|
||||
|
||||
@@ -251,6 +258,30 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
|
||||
this.internalPowerFlow = internalPowerFlow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReady()
|
||||
{
|
||||
super.onReady();
|
||||
|
||||
ic2Sink.onLoad();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
super.onChunkUnload();
|
||||
|
||||
ic2Sink.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
super.invalidate();
|
||||
|
||||
ic2Sink.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability( Capability<?> capability, EnumFacing facing )
|
||||
{
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
package appeng.tile.powersink;
|
||||
|
||||
|
||||
@@ -5,7 +22,7 @@ import appeng.api.config.PowerUnits;
|
||||
import appeng.api.networking.energy.IAEPowerStorage;
|
||||
|
||||
|
||||
interface IExternalPowerSink extends IAEPowerStorage
|
||||
public interface IExternalPowerSink extends IAEPowerStorage
|
||||
{
|
||||
|
||||
double injectExternalPower( PowerUnits input, double amt );
|
||||
|
||||
Reference in New Issue
Block a user