Fixed BC Power Handler.
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
package appeng.tile.powersink;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
|
||||
public class BCPerdition extends BaseBCperdition
|
||||
{
|
||||
|
||||
final protected PowerHandler bcPowerHandler;
|
||||
|
||||
public BCPerdition(IPowerReceptor te) {
|
||||
bcPowerHandler = new PowerHandler( te, Type.MACHINE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Tick()
|
||||
{
|
||||
bcPowerHandler.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound data)
|
||||
{
|
||||
bcPowerHandler.writeToNBT( data, "bcPowerHandler" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data)
|
||||
{
|
||||
bcPowerHandler.readFromNBT( data, "bcPowerHandler" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PowerReceiver getPowerReceiver()
|
||||
{
|
||||
return bcPowerHandler.getPowerReceiver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double useEnergy(float min, float max, boolean doUse)
|
||||
{
|
||||
return bcPowerHandler.useEnergy( min, max, doUse );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEnergy(float failed)
|
||||
{
|
||||
bcPowerHandler.addEnergy( failed );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(int i, int j, float f, int k)
|
||||
{
|
||||
bcPowerHandler.configure( i, j, f, k );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package appeng.tile.powersink;
|
||||
|
||||
import appeng.tile.events.AETileEventHandler;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
|
||||
public abstract class BaseBCperdition extends AETileEventHandler
|
||||
{
|
||||
|
||||
public BaseBCperdition() {
|
||||
super( TileEventType.TICK, TileEventType.WORLD_NBT );
|
||||
}
|
||||
|
||||
@Method(modid = "BuildCraftAPI|power")
|
||||
public abstract PowerReceiver getPowerReceiver();
|
||||
|
||||
public abstract double useEnergy(float f, float requred, boolean b);
|
||||
|
||||
public abstract void addEnergy(float failed);
|
||||
|
||||
public abstract void configure(int i, int j, float f, int k);
|
||||
|
||||
}
|
||||
@@ -4,12 +4,12 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.integration.abstraction.IBC;
|
||||
import appeng.integration.abstraction.IMJ;
|
||||
import appeng.integration.modules.helpers.BaseBCperdition;
|
||||
import appeng.util.Platform;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
|
||||
@@ -24,16 +24,14 @@ public abstract class BuildCraft extends AERootPoweredTile implements IPowerRece
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( Loader.isModLoaded( "BuildCraftAPI|power" ) )
|
||||
if ( AppEng.instance.isIntegrationEnabled( "MJ" ) )
|
||||
{
|
||||
if ( AppEng.instance.isIntegrationEnabled( "BC" ) )
|
||||
IMJ mjIntegration = (IMJ) AppEng.instance.getIntegration( "MJ" );
|
||||
if ( mjIntegration != null )
|
||||
{
|
||||
IBC bcIntegration = (IBC) AppEng.instance.getIntegration( "BC" );
|
||||
if ( bcIntegration != null )
|
||||
{
|
||||
addNewHandler( bcPowerWrapper = bcIntegration.createPerdition( this ) );
|
||||
addNewHandler( bcPowerWrapper = mjIntegration.createPerdition( this ) );
|
||||
if ( bcPowerWrapper != null )
|
||||
bcPowerWrapper.configure( 1, 380, 1.0f / 5.0f, 1000 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user