Fixed BC Power Handler.

This commit is contained in:
AlgorithmX2 2014-01-29 19:21:01 -06:00
parent b21af365cf
commit e7575c157b
8 changed files with 141 additions and 105 deletions

View file

@ -76,6 +76,7 @@ public class AppEng
IntegrationSide.BOTH, "Thermal Expansion", "ThermalExpansion", "TE", // TE
IntegrationSide.BOTH, "Mystcraft", "Mystcraft", "Mystcraft", // MC
IntegrationSide.BOTH, "BuildCraft", "BuildCraft|Silicon", "BC", // BC
IntegrationSide.BOTH, "BuildCraft Power", null, "MJ", // BC
IntegrationSide.BOTH, "Greg Tech", "gregtech_addon", "GT", // GT
IntegrationSide.BOTH, "Universal Electricity", null, "UE", // UE
IntegrationSide.BOTH, "Logistics Pipes", "LogisticsPipes|Main", "LP", // LP

View file

@ -7,8 +7,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraftforge.common.ForgeDirection;
import appeng.api.parts.IFacadePart;
import appeng.tile.powersink.BaseBCperdition;
import appeng.tile.powersink.BuildCraft;
public interface IBC
{
@ -43,6 +41,4 @@ public interface IBC
Icon getFacadeTexture();
BaseBCperdition createPerdition(BuildCraft buildCraft);
}

View file

@ -0,0 +1,11 @@
package appeng.integration.abstraction;
import appeng.integration.modules.helpers.BaseBCperdition;
import appeng.tile.powersink.BuildCraft;
public interface IMJ
{
BaseBCperdition createPerdition(BuildCraft buildCraft);
}

View file

@ -15,9 +15,6 @@ import appeng.facade.FacadePart;
import appeng.integration.IIntegrationModule;
import appeng.integration.abstraction.IBC;
import appeng.integration.modules.helpers.BCPipeHandler;
import appeng.tile.powersink.BCPerdition;
import appeng.tile.powersink.BaseBCperdition;
import appeng.tile.powersink.BuildCraft;
import buildcraft.BuildCraftEnergy;
import buildcraft.BuildCraftTransport;
import buildcraft.api.tools.IToolWrench;
@ -223,10 +220,4 @@ public class BC implements IIntegrationModule, IBC
// Pipe
}
@Override
public BaseBCperdition createPerdition(BuildCraft buildCraft)
{
return new BCPerdition( buildCraft );
}
}

View file

@ -0,0 +1,39 @@
package appeng.integration.modules;
import appeng.integration.IIntegrationModule;
import appeng.integration.abstraction.IMJ;
import appeng.integration.modules.helpers.BCPerdition;
import appeng.integration.modules.helpers.BaseBCperdition;
import appeng.tile.powersink.BuildCraft;
import buildcraft.api.power.IPowerReceptor;
public class MJ implements IIntegrationModule, IMJ
{
public static MJ instance;
@Override
public BaseBCperdition createPerdition(BuildCraft buildCraft)
{
if ( buildCraft instanceof IPowerReceptor )
return new BCPerdition( buildCraft );
return null;
}
@Override
public void Init() throws Throwable
{
if ( ((Object) this) instanceof BCPerdition )
{
}
}
@Override
public void PostInit() throws Throwable
{
// TODO Auto-generated method stub
}
}

View file

@ -1,4 +1,4 @@
package appeng.tile.powersink;
package appeng.integration.modules.helpers;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.power.IPowerReceptor;

View file

@ -1,4 +1,4 @@
package appeng.tile.powersink;
package appeng.integration.modules.helpers;
import appeng.tile.events.AETileEventHandler;
import appeng.tile.events.TileEventType;

View file

@ -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,19 +24,17 @@ 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 );
}
}
}
}
catch (Throwable t)
{
// ignore.. no bc?