IntegrationType Re-factor.

This commit is contained in:
AlgorithmX2 2014-07-23 17:26:23 -05:00
parent 50b0285c15
commit 980dff203f
30 changed files with 120 additions and 105 deletions

View file

@ -39,6 +39,7 @@ import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.CommonHelper;
import appeng.core.features.AEFeature;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IFMP;
import appeng.parts.ICableBusContainer;
import appeng.parts.NullCableBusContainer;
@ -412,8 +413,8 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
if ( te instanceof TileCableBus )
out = ((TileCableBus) te).cb;
else if ( AppEng.instance.isIntegrationEnabled( "FMP" ) )
out = ((IFMP) AppEng.instance.getIntegration( "FMP" )).getCableContainer( te );
else if ( AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
out = ((IFMP) AppEng.instance.getIntegration( IntegrationType.FMP )).getCableContainer( te );
return out == null ? nullCB : out;
}

View file

@ -25,6 +25,7 @@ import appeng.core.WorldSettings;
import appeng.core.features.AEFeature;
import appeng.helpers.LocationRotation;
import appeng.helpers.NullRotation;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IRB;
import appeng.util.Platform;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@ -94,12 +95,12 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock
@Override
public IOrientable getOrientable(final IBlockAccess w, final int x, final int y, final int z)
{
if ( AppEng.instance.isIntegrationEnabled( "RB" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.RB ) )
{
TileEntity te = w.getTileEntity( x, y, z );
if ( te != null )
{
IOrientable out = ((IRB) AppEng.instance.getIntegration( "RB" )).getOrientable( te );
IOrientable out = ((IRB) AppEng.instance.getIntegration( IntegrationType.RB )).getOrientable( te );
if ( out != null )
return out;
}

View file

@ -48,6 +48,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.core.sync.packets.PacketSwapSlots;
import appeng.helpers.InventoryAction;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.INEI;
import appeng.util.Platform;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
@ -684,9 +685,9 @@ public abstract class AEBaseGui extends GuiContainer
private RenderItem setItemRender(RenderItem aeri2)
{
if ( AppEng.instance.isIntegrationEnabled( "NEI" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.NEI ) )
{
return ((INEI) AppEng.instance.getIntegration( "NEI" )).setItemRender( aeri2 );
return ((INEI) AppEng.instance.getIntegration( IntegrationType.NEI )).setItemRender( aeri2 );
}
else
{

View file

@ -38,6 +38,7 @@ import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.integration.IntegrationType;
import appeng.parts.reporting.PartTerminal;
import appeng.tile.misc.TileSecurity;
import appeng.util.IConfigManagerHost;
@ -148,7 +149,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
maxRows = getMaxRows();
perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ((width - standardSize) / 18);
boolean hasNEI = AppEng.instance.isIntegrationEnabled( "NEI" );
boolean hasNEI = AppEng.instance.isIntegrationEnabled( IntegrationType.NEI );
int NEI = hasNEI ? 0 : 0;
int top = hasNEI ? 22 : 0;

View file

@ -5,6 +5,7 @@ import appeng.client.gui.AEBaseGui;
import appeng.container.implementations.ContainerSkyChest;
import appeng.core.AppEng;
import appeng.core.localization.GuiText;
import appeng.integration.IntegrationType;
import appeng.tile.storage.TileSkyChest;
public class GuiSkyChest extends AEBaseGui
@ -32,7 +33,7 @@ public class GuiSkyChest extends AEBaseGui
@Override
protected boolean enableSpaceClicking()
{
return !AppEng.instance.isIntegrationEnabled( "InvTweaks" );
return !AppEng.instance.isIntegrationEnabled( IntegrationType.InvTweaks );
}
}

View file

@ -18,6 +18,7 @@ import appeng.core.sync.GuiBridge;
import appeng.core.sync.network.NetworkHandler;
import appeng.hooks.TickHandler;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.server.AECommand;
import appeng.services.Profiler;
import appeng.services.VersionChecker;
@ -85,12 +86,12 @@ public class AppEng
FMLCommonHandler.instance().registerCrashCallable( new CrashEnhancement( CrashInfo.MOD_VERSION ) );
}
public boolean isIntegrationEnabled(String Name)
public boolean isIntegrationEnabled( IntegrationType Name )
{
return IntegrationRegistry.instance.isEnabled( Name );
}
public Object getIntegration(String Name)
public Object getIntegration( IntegrationType Name )
{
return IntegrationRegistry.instance.getInstance( Name );
}

View file

@ -98,6 +98,7 @@ import appeng.hooks.AETrading;
import appeng.hooks.MeteoriteWorldGen;
import appeng.hooks.QuartzWorldGen;
import appeng.hooks.TickHandler;
import appeng.integration.IntegrationType;
import appeng.items.materials.ItemMultiMaterial;
import appeng.items.materials.MaterialType;
import appeng.items.misc.ItemCrystalSeed;
@ -511,22 +512,22 @@ public class Registration
ph.registerNewLayer( "appeng.parts.layers.LayerIFluidHandler", "net.minecraftforge.fluids.IFluidHandler" );
ph.registerNewLayer( "appeng.parts.layers.LayerITileStorageMonitorable", "appeng.api.implementations.tiles.ITileStorageMonitorable" );
if ( AppEng.instance.isIntegrationEnabled( "IC2" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.IC2 ) )
{
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" );
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
}
if ( AppEng.instance.isIntegrationEnabled( "MJ5" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.MJ5 ) )
{
ph.registerNewLayer( "appeng.parts.layers.LayerIPowerEmitter", "buildcraft.api.power.IPowerEmitter" );
ph.registerNewLayer( "appeng.parts.layers.LayerIPowerReceptor", "buildcraft.api.power.IPowerReceptor" );
}
if ( AppEng.instance.isIntegrationEnabled( "MJ6" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.MJ6 ) )
ph.registerNewLayer( "appeng.parts.layers.LayerIBatteryProvider", "buildcraft.api.mj.IBatteryProvider" );
if ( AppEng.instance.isIntegrationEnabled( "RF" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.RF ) )
ph.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyHandler" );
FMLCommonHandler.instance().bus().register( TickHandler.instance );

View file

@ -29,6 +29,7 @@ import appeng.api.parts.LayerBase;
import appeng.client.render.BusRenderer;
import appeng.core.AELog;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IFMP;
import appeng.parts.PartPlacement;
import appeng.tile.networking.TileCableBus;
@ -52,8 +53,8 @@ public class ApiPart implements IPartHelper
{
for (Class layerInterface : interfaces2Layer.keySet())
{
if ( AppEng.instance.isIntegrationEnabled( "FMP" ) )
((IFMP) AppEng.instance.getIntegration( "FMP" )).registerPassThru( layerInterface );
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
((IFMP) AppEng.instance.getIntegration( IntegrationType.FMP )).registerPassThru( layerInterface );
}
}

View file

@ -11,6 +11,7 @@ import net.minecraftforge.common.MinecraftForge;
import appeng.core.AppEng;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IFMP;
public class PacketMultiPart extends AppEngPacket
@ -24,7 +25,7 @@ public class PacketMultiPart extends AppEngPacket
@Override
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
{
IFMP fmp = (IFMP) AppEng.instance.getIntegration( "FMP" );
IFMP fmp = (IFMP) AppEng.instance.getIntegration( IntegrationType.FMP );
if ( fmp != null )
{
EntityPlayerMP sender = (EntityPlayerMP) player;

View file

@ -14,6 +14,7 @@ import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IFacadePart;
import appeng.api.parts.IPartHost;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
import appeng.items.parts.ItemFacade;
@ -63,9 +64,9 @@ public class FacadeContainer implements IFacadeContainer
boolean isBC = ids[0] < 0;
ids[0] = Math.abs( ids[0] );
if ( isBC && AppEng.instance.isIntegrationEnabled( "BC" ) )
if ( isBC && AppEng.instance.isIntegrationEnabled( IntegrationType.BC ) )
{
IBC bc = (IBC) AppEng.instance.getIntegration( "BC" );
IBC bc = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
changed = changed || facades[x] == null;
facades[x] = bc.createFacadePart( (Block) Block.blockRegistry.getObjectById( ids[0] ), ids[1], side );
}
@ -107,9 +108,9 @@ public class FacadeContainer implements IFacadeContainer
facades[x] = ((IFacadeItem) i).createPartFromItemStack( is, ForgeDirection.getOrientation( x ) );
else
{
if ( AppEng.instance.isIntegrationEnabled( "BC" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.BC ) )
{
IBC bc = (IBC) AppEng.instance.getIntegration( "BC" );
IBC bc = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
if ( bc.isFacade( is ) )
facades[x] = bc.createFacadePart( is, ForgeDirection.getOrientation( x ) );
}

View file

@ -25,6 +25,7 @@ import appeng.client.render.BusRenderHelper;
import appeng.client.render.RenderBlocksWorkaround;
import appeng.core.AELog;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -71,9 +72,9 @@ public class FacadePart implements IFacadePart
IFacadeItem fi = (IFacadeItem) facade.getItem();
return fi.getTextureItem( facade );
}
else if ( AppEng.instance.isIntegrationEnabled( "BC" ) )
else if ( AppEng.instance.isIntegrationEnabled( IntegrationType.BC ) )
{
IBC bc = (IBC) AppEng.instance.getIntegration( "BC" );
IBC bc = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
return bc.getTextureForFacade( facade );
}
return null;
@ -109,7 +110,7 @@ public class FacadePart implements IFacadePart
IIcon myIcon = null;
if ( isBC() )
{
IBC bc = (IBC) AppEng.instance.getIntegration( "BC" );
IBC bc = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
myIcon = bc.getFacadeTexture();
}

View file

@ -17,13 +17,13 @@ public class IntegrationNode
String displayName;
String modID;
String shortName;
IntegrationType shortName;
String name = null;
Class classValue = null;
Object instance;
IIntegrationModule mod = null;
public IntegrationNode(String dspname, String _modID, String sName, String n) {
public IntegrationNode(String dspname, String _modID, IntegrationType sName, String n) {
displayName = dspname;
shortName = sName;
modID = _modID;

View file

@ -9,18 +9,17 @@ public class IntegrationRegistry
{
public static IntegrationRegistry instance = null;
private LinkedList<IntegrationNode> modules = new LinkedList<IntegrationNode>();
public void add(IntegrationSide side, String dspname, String modID, String name)
public void add( IntegrationType type)
{
if ( side == IntegrationSide.CLIENT && FMLLaunchHandler.side() == Side.SERVER )
if ( type.side == IntegrationSide.CLIENT && FMLLaunchHandler.side() == Side.SERVER )
return;
if ( side == IntegrationSide.SERVER && FMLLaunchHandler.side() == Side.CLIENT )
if ( type.side == IntegrationSide.SERVER && FMLLaunchHandler.side() == Side.CLIENT )
return;
modules.add( new IntegrationNode( dspname, modID, name, "appeng.integration.modules." + name ) );
modules.add( new IntegrationNode( type.dspName, type.modID, type, "appeng.integration.modules." + type.name() ) );
}
public IntegrationRegistry() {
@ -59,17 +58,17 @@ public class IntegrationRegistry
return out;
}
public boolean isEnabled(String name)
public boolean isEnabled(IntegrationType name)
{
for (IntegrationNode node : modules)
{
if ( node.shortName.equals( name ) )
if ( node.shortName == name )
return node.isActive();
}
throw new RuntimeException( "invalid integration" );
return false;
}
public Object getInstance(String name)
public Object getInstance(IntegrationType name)
{
for (IntegrationNode node : modules)
{
@ -78,7 +77,7 @@ public class IntegrationRegistry
return node.instance;
}
}
throw new RuntimeException( "invalid integration" );
throw new RuntimeException( "integration with "+name.name()+" is disabled." );
}
}

View file

@ -29,6 +29,7 @@ import appeng.core.AppEng;
import appeng.core.localization.GuiText;
import appeng.core.localization.WailaText;
import appeng.integration.BaseModule;
import appeng.integration.IntegrationType;
import appeng.parts.networking.PartCableSmart;
import appeng.parts.networking.PartDenseCable;
import appeng.tile.misc.TileCharger;
@ -44,7 +45,7 @@ public class Waila extends BaseModule implements IWailaDataProvider, IWailaFMPPr
public static void register(IWailaRegistrar registrar)
{
Waila w = (Waila) AppEng.instance.getIntegration( "Waila" );
Waila w = (Waila) AppEng.instance.getIntegration( IntegrationType.Waila );
registrar.registerBodyProvider( w, AEBaseBlock.class );
registrar.registerBodyProvider( w, "ae2_cablebus" );

View file

@ -42,6 +42,7 @@ import appeng.core.AELog;
import appeng.core.AppEng;
import appeng.facade.FacadeContainer;
import appeng.helpers.AEMultiTile;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.ICLApi;
import appeng.me.GridConnection;
import appeng.util.Platform;
@ -792,8 +793,8 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
light = Math.max( p.getLightLevel(), light );
}
if ( light > 0 && AppEng.instance.isIntegrationEnabled( "CLApi" ) )
return ((ICLApi) AppEng.instance.getIntegration( "CLApi" )).colorLight( getColor(), light );
if ( light > 0 && AppEng.instance.isIntegrationEnabled( IntegrationType.CLApi ) )
return ((ICLApi) AppEng.instance.getIntegration( IntegrationType.CLApi )).colorLight( getColor(), light );
return light;
}

View file

@ -31,6 +31,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketClick;
import appeng.core.sync.packets.PacketPartPlacement;
import appeng.facade.IFacadeItem;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
import appeng.integration.abstraction.IFMP;
import appeng.util.LookDirection;
@ -222,8 +223,8 @@ public class PartPlacement
}
}
if ( host == null && tile != null && AppEng.instance.isIntegrationEnabled( "FMP" ) )
host = ((IFMP) AppEng.instance.getIntegration( "FMP" )).getOrCreateHost( tile );
if ( host == null && tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
host = ((IFMP) AppEng.instance.getIntegration( IntegrationType.FMP )).getOrCreateHost( tile );
// if ( held == null )
{
@ -286,8 +287,8 @@ public class PartPlacement
if ( tile instanceof IPartHost )
host = (IPartHost) tile;
if ( host == null && tile != null && AppEng.instance.isIntegrationEnabled( "FMP" ) )
host = ((IFMP) AppEng.instance.getIntegration( "FMP" )).getOrCreateHost( tile );
if ( host == null && tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
host = ((IFMP) AppEng.instance.getIntegration( IntegrationType.FMP )).getOrCreateHost( tile );
if ( host == null && AEApi.instance().blocks().blockMultiPart.block().canPlaceBlockAt( world, te_x, te_y, te_z )
&& ib.placeBlockAt( is, player, world, te_x, te_y, te_z, side.ordinal(), 0.5f, 0.5f, 0.5f, 0 ) )
@ -335,8 +336,8 @@ public class PartPlacement
Block blkID = world.getBlock( te_x, te_y, te_z );
tile = world.getTileEntity( te_x, te_y, te_z );
if ( tile != null && AppEng.instance.isIntegrationEnabled( "FMP" ) )
host = ((IFMP) AppEng.instance.getIntegration( "FMP" )).getOrCreateHost( tile );
if ( tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
host = ((IFMP) AppEng.instance.getIntegration( IntegrationType.FMP )).getOrCreateHost( tile );
if ( (blkID == null || blkID.isReplaceable( world, te_x, te_y, te_z ) || host != null) && offset != ForgeDirection.UNKNOWN )
return place( held, te_x, te_y, te_z, side.getOpposite().ordinal(), player, world,
@ -400,9 +401,9 @@ public class PartPlacement
if ( held.getItem() instanceof IFacadeItem )
return ((IFacadeItem) held.getItem()).createPartFromItemStack( held, side );
if ( AppEng.instance.isIntegrationEnabled( "BC" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.BC ) )
{
IBC bc = (IBC) AppEng.instance.getIntegration( "BC" );
IBC bc = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
if ( bc.isFacade( held ) )
return bc.createFacadePart( held, side );
}

View file

@ -15,6 +15,7 @@ import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.core.AppEng;
import appeng.core.settings.TickRates;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IMJ5;
import appeng.integration.abstraction.IMJ6;
import appeng.integration.abstraction.helpers.BaseMJperdition;
@ -49,12 +50,12 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
public PartP2PBCPower(ItemStack is) {
super( is );
if ( !AppEng.instance.isIntegrationEnabled( "MJ5" ) && !AppEng.instance.isIntegrationEnabled( "MJ6" ) )
if ( !AppEng.instance.isIntegrationEnabled( IntegrationType.MJ5 ) && !AppEng.instance.isIntegrationEnabled( IntegrationType.MJ6 ) )
throw new RuntimeException( "MJ Not installed!" );
if ( AppEng.instance.isIntegrationEnabled( "MJ5" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.MJ5 ) )
{
pp = (BaseMJperdition) ((IMJ5) AppEng.instance.getIntegration( "MJ5" )).createPerdition( this );
pp = (BaseMJperdition) ((IMJ5) AppEng.instance.getIntegration( IntegrationType.MJ5 )).createPerdition( this );
if ( pp != null )
pp.configure( 1, 380, 1.0f / 5.0f, 1000 );
}
@ -158,8 +159,8 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
IBatteryObject bo = MjAPI.getMjBattery( te, MjAPI.DEFAULT_POWER_FRAMEWORK, side.getOpposite() );
if ( bo != null )
return bo;
if ( AppEng.instance.isIntegrationEnabled( "MJ5" ) )
return ((IMJ6) AppEng.instance.getIntegration( "MJ6" )).provider( te, side.getOpposite() );
return ((IMJ6) AppEng.instance.getIntegration( IntegrationType.MJ6 )).provider( te, side.getOpposite() );
}
return null;
}

View file

@ -11,6 +11,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.config.PowerUnits;
import appeng.api.config.TunnelType;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.me.GridAccessException;
import appeng.me.cache.helpers.TunnelCollection;
import appeng.transformer.annotations.integration.Interface;
@ -32,7 +33,7 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
public PartP2PIC2Power(ItemStack is) {
super( is );
if ( !AppEng.instance.isIntegrationEnabled( "IC2" ) )
if ( !AppEng.instance.isIntegrationEnabled( IntegrationType.IC2 ) )
throw new RuntimeException( "IC2 Not installed!" );
}

View file

@ -23,6 +23,7 @@ import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.core.AppEng;
import appeng.core.settings.TickRates;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
import appeng.me.GridAccessException;
import appeng.me.cache.helpers.TunnelCollection;
@ -70,9 +71,9 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
which.add( this );
if ( AppEng.instance.isIntegrationEnabled( "BC" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.BC ) )
{
IBC buildcraft = (IBC) AppEng.instance.getIntegration( "BC" );
IBC buildcraft = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
if ( buildcraft != null )
{
if ( buildcraft.isPipe( te, side.getOpposite() ) )

View file

@ -11,6 +11,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.config.PowerUnits;
import appeng.api.config.TunnelType;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.modules.helpers.NullRFHandler;
import appeng.me.GridAccessException;
import appeng.transformer.annotations.integration.Interface;
@ -37,7 +38,7 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements cof
public PartP2PRFPower(ItemStack is) {
super( is );
if ( !AppEng.instance.isIntegrationEnabled( "RF" ) )
if ( !AppEng.instance.isIntegrationEnabled( IntegrationType.RF ) )
throw new RuntimeException( "RF Not installed!" );
}

View file

@ -10,6 +10,7 @@ import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient;
import appeng.core.AELog;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IRC;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
@ -39,9 +40,9 @@ public class Crusher implements ICraftHandler, IWebsiteSeralizer
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( AppEng.instance.isIntegrationEnabled( "RC" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.RC ) )
{
IRC rc = (IRC) AppEng.instance.getIntegration( "RC" );
IRC rc = (IRC) AppEng.instance.getIntegration( IntegrationType.RC );
for (ItemStack is : pro_input.getItemStackSet())
{
try

View file

@ -10,6 +10,7 @@ import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient;
import appeng.core.AELog;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IFZ;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
@ -39,9 +40,9 @@ public class GrindFZ implements ICraftHandler, IWebsiteSeralizer
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( AppEng.instance.isIntegrationEnabled( "FZ" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.FZ ) )
{
IFZ fz = (IFZ) AppEng.instance.getIntegration( "FZ" );
IFZ fz = (IFZ) AppEng.instance.getIntegration( IntegrationType.FZ );
for (ItemStack is : pro_input.getItemStackSet())
{
try

View file

@ -10,6 +10,7 @@ import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient;
import appeng.core.AELog;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IIC2;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
@ -39,9 +40,9 @@ public class Macerator implements ICraftHandler, IWebsiteSeralizer
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( AppEng.instance.isIntegrationEnabled( "IC2" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.IC2 ) )
{
IIC2 ic2 = (IIC2) AppEng.instance.getIntegration( "IC2" );
IIC2 ic2 = (IIC2) AppEng.instance.getIntegration( IntegrationType.IC2 );
for (ItemStack is : pro_input.getItemStackSet())
{
try

View file

@ -8,6 +8,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.config.PowerUnits;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IIC2;
import appeng.transformer.annotations.integration.Interface;
import appeng.util.Platform;
@ -77,9 +78,9 @@ public abstract class IC2 extends MinecraftJoules6 implements IEnergySink
final private void addToENet()
{
if ( AppEng.instance.isIntegrationEnabled( "IC2" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.IC2 ) )
{
IIC2 ic2Integration = (IIC2) AppEng.instance.getIntegration( "IC2" );
IIC2 ic2Integration = (IIC2) AppEng.instance.getIntegration( IntegrationType.IC2 );
if ( !isInIC2 && Platform.isServer() && ic2Integration != null )
{
ic2Integration.addToEnergyNet( this );
@ -90,9 +91,9 @@ public abstract class IC2 extends MinecraftJoules6 implements IEnergySink
final private void removeFromENet()
{
if ( AppEng.instance.isIntegrationEnabled( "IC2" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.IC2 ) )
{
IIC2 ic2Integration = (IIC2) AppEng.instance.getIntegration( "IC2" );
IIC2 ic2Integration = (IIC2) AppEng.instance.getIntegration( IntegrationType.IC2 );
if ( isInIC2 && Platform.isServer() && ic2Integration != null )
{
ic2Integration.removeFromEnergyNet( this );

View file

@ -4,6 +4,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.config.PowerUnits;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IMJ5;
import appeng.integration.abstraction.helpers.BaseMJperdition;
import appeng.transformer.annotations.integration.Interface;
@ -24,9 +25,9 @@ public abstract class MinecraftJoules5 extends AERootPoweredTile implements IPow
{
try
{
if ( AppEng.instance.isIntegrationEnabled( "MJ5" ) )
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.MJ5 ) )
{
IMJ5 mjIntegration = (IMJ5) AppEng.instance.getIntegration( "MJ5" );
IMJ5 mjIntegration = (IMJ5) AppEng.instance.getIntegration( IntegrationType.MJ5 );
if ( mjIntegration != null )
{
addNewHandler( bcPowerWrapper = (BaseMJperdition) mjIntegration.createPerdition( this ) );

View file

@ -14,7 +14,7 @@ import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationSide;
import appeng.integration.IntegrationType;
import appeng.transformer.annotations.integration;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
@ -29,34 +29,20 @@ public class ASMIntegration implements IClassTransformer
* Side, Display Name, ModID ClassPostFix
*/
integrationModules.add( IntegrationSide.BOTH, "Rotary Craft", "RotaryCraft", "RotaryCraft" );
integrationModules.add( IntegrationSide.BOTH, "Industrial Craft 2", "IC2", "IC2" );
integrationModules.add( IntegrationSide.BOTH, "Railcraft", "Railcraft", "RC" );
// integrationModules.add( IntegrationSide.BOTH, "Thermal Expansion", "ThermalExpansion", "TE" );
// integrationModules.add( IntegrationSide.BOTH, "Mystcraft", "Mystcraft", "Mystcraft" );
integrationModules.add( IntegrationSide.BOTH, "BuildCraft", "BuildCraft|Silicon", "BC" );
integrationModules.add( IntegrationSide.BOTH, "BuildCraft5 Power", null, "MJ5" );
integrationModules.add( IntegrationSide.BOTH, "BuildCraft6 Power", null, "MJ6" );
for ( IntegrationType type : IntegrationType.values() )
{
integrationModules.add( type );
}
// integrationModules.add( IntegrationSide.BOTH, "Thermal Expansion", "ThermalExpansion", IntegrationType.TE );
// integrationModules.add( IntegrationSide.BOTH, "Mystcraft", "Mystcraft", IntegrationType.Mystcraft );
// integrationModules.add( IntegrationSide.BOTH, "Greg Tech", "gregtech_addon", IntegrationType.GT );
// integrationModules.add( IntegrationSide.BOTH, "Universal Electricity", null, IntegrationType.UE );
// integrationModules.add( IntegrationSide.BOTH, "Logistics Pipes", "LogisticsPipes|Main", IntegrationType.LP );
// integrationModules.add( IntegrationSide.BOTH, "Better Storage", IntegrationType.betterstorage );
// integrationModules.add( IntegrationSide.BOTH, "Forestry", "Forestry", IntegrationType.Forestry );
// integrationModules.add( IntegrationSide.BOTH, "Mekanism", "Mekanism", IntegrationType.Mekanism );
integrationModules.add( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", null, "RF" );
integrationModules.add( IntegrationSide.BOTH, "RedstoneFlux Power - Items", null, "RFItem" );
// integrationModules.add( IntegrationSide.BOTH, "Greg Tech", "gregtech_addon", "GT" );
// integrationModules.add( IntegrationSide.BOTH, "Universal Electricity", null, "UE" );
// integrationModules.add( IntegrationSide.BOTH, "Logistics Pipes", "LogisticsPipes|Main", "LP" );
integrationModules.add( IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded", "MFR" );
integrationModules.add( IntegrationSide.BOTH, "Deep Storage Unit", null, "DSU" );
// integrationModules.add( IntegrationSide.BOTH, "Better Storage", "betterstorage" );
integrationModules.add( IntegrationSide.BOTH, "Factorization", "factorization", "FZ" );
// integrationModules.add( IntegrationSide.BOTH, "Forestry", "Forestry", "Forestry" );
// integrationModules.add( IntegrationSide.BOTH, "Mekanism", "Mekanism", "Mekanism" );
integrationModules.add( IntegrationSide.CLIENT, "Waila", "Waila", "Waila" );
integrationModules.add( IntegrationSide.BOTH, "Colored Lights Core", "coloredlightscore", "CLApi" );
integrationModules.add( IntegrationSide.BOTH, "Rotatable Blocks", "RotatableBlocks", "RB" );
integrationModules.add( IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks", "InvTweaks" );
integrationModules.add( IntegrationSide.CLIENT, "Not Enough Items", "NotEnoughItems", "NEI" );
integrationModules.add( IntegrationSide.CLIENT, "Craft Guide", "craftguide", "CraftGuide" );
integrationModules.add( IntegrationSide.BOTH, "Forge MultiPart", "McMultipart", "FMP" );
}
@Override
@ -158,7 +144,8 @@ public class ASMIntegration implements IClassTransformer
if ( iName != null )
{
if ( !IntegrationRegistry.instance.isEnabled( iName ) )
IntegrationType type = IntegrationType.valueOf( iName );
if ( !IntegrationRegistry.instance.isEnabled( type ) )
{
log( "Removing Method " + mn.name + " from " + classNode.name + " because " + iName + " integration is disabled." );
i.remove();
@ -191,9 +178,11 @@ public class ASMIntegration implements IClassTransformer
else if ( an.values.get( 2 ).equals( "iname" ) )
iName = (String) an.values.get( 3 );
IntegrationType type = IntegrationType.valueOf( iName );
if ( iName != null && iFace != null )
{
if ( !IntegrationRegistry.instance.isEnabled( iName ) )
if ( !IntegrationRegistry.instance.isEnabled( type ) )
{
log( "Removing Interface " + iFace + " from " + classNode.name + " because " + iName + " integration is disabled." );
classNode.interfaces.remove( iFace.replace( '.', '/' ) );

View file

@ -5,6 +5,7 @@ import java.util.Comparator;
import appeng.api.config.SortDir;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IInvTweaks;
public class ItemSorters
@ -18,8 +19,8 @@ public class ItemSorters
if ( api != null )
return;
if ( AppEng.instance.isIntegrationEnabled( "InvTweaks" ) )
api = (IInvTweaks) AppEng.instance.getIntegration( "InvTweaks" );
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.InvTweaks ) )
api = (IInvTweaks) AppEng.instance.getIntegration( IntegrationType.InvTweaks );
else
api = null;
}

View file

@ -87,6 +87,7 @@ import appeng.core.AppEng;
import appeng.core.features.AEFeature;
import appeng.core.sync.GuiBridge;
import appeng.hooks.TickHandler;
import appeng.integration.IntegrationType;
import appeng.me.GridAccessException;
import appeng.me.GridNode;
import appeng.me.helpers.AENetworkProxy;
@ -236,13 +237,13 @@ public class Platform
private static boolean isNotValidSetting(Enum e)
{
if ( e == SortOrder.INVTWEAKS && !AppEng.instance.isIntegrationEnabled( "InvTweaks" ) )
if ( e == SortOrder.INVTWEAKS && !AppEng.instance.isIntegrationEnabled( IntegrationType.InvTweaks ) )
return true;
if ( e == SearchBoxMode.NEI_AUTOSEARCH && !AppEng.instance.isIntegrationEnabled( "NEI" ) )
if ( e == SearchBoxMode.NEI_AUTOSEARCH && !AppEng.instance.isIntegrationEnabled( IntegrationType.NEI ) )
return true;
if ( e == SearchBoxMode.NEI_MANUAL_SEARCH && !AppEng.instance.isIntegrationEnabled( "NEI" ) )
if ( e == SearchBoxMode.NEI_MANUAL_SEARCH && !AppEng.instance.isIntegrationEnabled( IntegrationType.NEI ) )
return true;
return false;

View file

@ -7,6 +7,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.config.FuzzyMode;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
import appeng.util.InventoryAdaptor;
import appeng.util.iterators.NullIterator;
@ -19,7 +20,7 @@ public class AdaptorBCPipe extends InventoryAdaptor
final private ForgeDirection d;
public AdaptorBCPipe(TileEntity s, ForgeDirection dd) {
bc = (IBC) AppEng.instance.getIntegration( "BC" );
bc = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
if ( bc != null )
{
if ( bc.isPipe( s, dd ) )

View file

@ -6,6 +6,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.core.AppEng;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
public class WrapperBCPipe implements IInventory
@ -16,7 +17,7 @@ public class WrapperBCPipe implements IInventory
final private ForgeDirection dir;
public WrapperBCPipe(TileEntity te, ForgeDirection d) {
bc = (IBC) AppEng.instance.getIntegration( "BC" );
bc = (IBC) AppEng.instance.getIntegration( IntegrationType.BC );
ad = te;
dir = d;
}