Cleaned up unused Mod integrations other than for mods that are likely to be integrated soon.

Introduced an easier Facade class to access mod integration abstractions (called Integrations). Removed the link between IntegrationType and integration abstraction. Integrations are now explicitly instantiated inside of IntegrationNode.
This commit is contained in:
Sebastian Hartte 2016-11-06 01:03:02 +01:00
parent 3a8d6d0bcd
commit 633ea48d42
55 changed files with 271 additions and 1305 deletions

View file

@ -69,9 +69,6 @@ import appeng.client.render.cablebus.CableBusRenderState;
import appeng.core.Api; import appeng.core.Api;
import appeng.core.AppEng; import appeng.core.AppEng;
import appeng.helpers.AEGlassMaterial; import appeng.helpers.AEGlassMaterial;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IFMP;
import appeng.parts.ICableBusContainer; import appeng.parts.ICableBusContainer;
import appeng.parts.NullCableBusContainer; import appeng.parts.NullCableBusContainer;
import appeng.tile.AEBaseTile; import appeng.tile.AEBaseTile;
@ -349,10 +346,6 @@ public class BlockCableBus extends AEBaseTileBlock
{ {
out = ( (TileCableBus) te ).getCableBus(); out = ( (TileCableBus) te ).getCableBus();
} }
else if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
{
out = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getCableContainer( te );
}
return out == null ? NULL_CABLE_BUS : out; return out == null ? NULL_CABLE_BUS : out;
} }

View file

@ -24,8 +24,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import appeng.client.gui.AEBaseGui; import appeng.client.gui.AEBaseGui;
import appeng.container.implementations.ContainerSkyChest; import appeng.container.implementations.ContainerSkyChest;
import appeng.core.localization.GuiText; import appeng.core.localization.GuiText;
import appeng.integration.IntegrationRegistry; import appeng.integration.Integrations;
import appeng.integration.IntegrationType;
import appeng.tile.storage.TileSkyChest; import appeng.tile.storage.TileSkyChest;
@ -55,6 +54,6 @@ public class GuiSkyChest extends AEBaseGui
@Override @Override
protected boolean enableSpaceClicking() protected boolean enableSpaceClicking()
{ {
return !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.InvTweaks ); return !Integrations.invTweaks().isEnabled();
} }
} }

View file

@ -37,7 +37,7 @@ import appeng.api.storage.data.IItemList;
import appeng.client.gui.widgets.IScrollSource; import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource; import appeng.client.gui.widgets.ISortSource;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import appeng.integration.modules.JEI; import appeng.integration.Integrations;
import appeng.items.storage.ItemViewCell; import appeng.items.storage.ItemViewCell;
import appeng.util.ItemSorters; import appeng.util.ItemSorters;
import appeng.util.Platform; import appeng.util.Platform;
@ -58,7 +58,6 @@ public class ItemRepo
private String searchString = ""; private String searchString = "";
private IPartitionList<IAEItemStack> myPartitionList; private IPartitionList<IAEItemStack> myPartitionList;
private String innerSearch = ""; private String innerSearch = "";
private String jeiSearch = null;
private boolean hasPower; private boolean hasPower;
public ItemRepo( final IScrollSource src, final ISortSource sortSrc ) public ItemRepo( final IScrollSource src, final ISortSource sortSrc )
@ -244,7 +243,7 @@ public class ItemRepo
private void updateJEI( String filter ) private void updateJEI( String filter )
{ {
JEI.instance.getJei().setSearchText( filter ); Integrations.jei().setSearchText( filter );
} }
public int size() public int size()

View file

@ -63,8 +63,7 @@ import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages; import appeng.core.localization.PlayerMessages;
import appeng.core.stats.PlayerStatsRegistration; import appeng.core.stats.PlayerStatsRegistration;
import appeng.hooks.TickHandler; import appeng.hooks.TickHandler;
import appeng.integration.IntegrationRegistry; import appeng.integration.Integrations;
import appeng.integration.IntegrationType;
import appeng.items.materials.ItemMaterial; import appeng.items.materials.ItemMaterial;
import appeng.items.parts.ItemFacade; import appeng.items.parts.ItemFacade;
import appeng.loot.ChestLoot; import appeng.loot.ChestLoot;
@ -86,7 +85,6 @@ import appeng.recipes.game.ShapedRecipe;
import appeng.recipes.game.ShapelessRecipe; import appeng.recipes.game.ShapelessRecipe;
import appeng.recipes.handlers.Crusher; import appeng.recipes.handlers.Crusher;
import appeng.recipes.handlers.Grind; import appeng.recipes.handlers.Grind;
import appeng.recipes.handlers.GrindFZ;
import appeng.recipes.handlers.HCCrusher; import appeng.recipes.handlers.HCCrusher;
import appeng.recipes.handlers.Inscribe; import appeng.recipes.handlers.Inscribe;
import appeng.recipes.handlers.Macerator; import appeng.recipes.handlers.Macerator;
@ -216,7 +214,6 @@ public final class Registration
registry.addNewCraftHandler( "mekechamber", MekEnrichment.class ); registry.addNewCraftHandler( "mekechamber", MekEnrichment.class );
registry.addNewCraftHandler( "grind", Grind.class ); registry.addNewCraftHandler( "grind", Grind.class );
registry.addNewCraftHandler( "crusher", Crusher.class ); registry.addNewCraftHandler( "crusher", Crusher.class );
registry.addNewCraftHandler( "grindfz", GrindFZ.class );
registry.addNewCraftHandler( "pulverizer", Pulverizer.class ); registry.addNewCraftHandler( "pulverizer", Pulverizer.class );
registry.addNewCraftHandler( "macerator", Macerator.class ); registry.addNewCraftHandler( "macerator", Macerator.class );
@ -248,7 +245,7 @@ public final class Registration
final Runnable recipeLoader = new RecipeLoader( recipeDirectory, customRecipeConfig, this.recipeHandler ); final Runnable recipeLoader = new RecipeLoader( recipeDirectory, customRecipeConfig, this.recipeHandler );
recipeLoader.run(); recipeLoader.run();
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) ) if( Integrations.ic2().isEnabled() )
{ {
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" ); partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" );
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" ); partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
@ -334,8 +331,6 @@ public final class Registration
PlayerMessages.values(); PlayerMessages.values();
GuiText.values(); GuiText.values();
Api.INSTANCE.partHelper().initFMPSupport();
definitions.getRegistry().getBootstrapComponents().forEach( b -> b.postInitialize( event.getSide() ) ); definitions.getRegistry().getBootstrapComponents().forEach( b -> b.postInitialize( event.getSide() ) );
// Interface // Interface

View file

@ -56,9 +56,6 @@ import appeng.api.parts.IPartHelper;
import appeng.api.parts.LayerBase; import appeng.api.parts.LayerBase;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.core.CommonHelper; import appeng.core.CommonHelper;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IFMP;
import appeng.parts.PartPlacement; import appeng.parts.PartPlacement;
import appeng.tile.AEBaseTile; import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus; import appeng.tile.networking.TileCableBus;
@ -79,17 +76,6 @@ public class ApiPart implements IPartHelper
private final Map<Class<?>, String> interfaces2Layer = new HashMap<>(); private final Map<Class<?>, String> interfaces2Layer = new HashMap<>();
private final List<String> desc = new LinkedList<String>(); private final List<String> desc = new LinkedList<String>();
public void initFMPSupport()
{
for( final Class layerInterface : this.interfaces2Layer.keySet() )
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
{
( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).registerPassThrough( layerInterface );
}
}
}
/** /**
* Conceptually this method will build a new class hierarchy that is rooted at the given base class, and includes a chain of all registered layers. * Conceptually this method will build a new class hierarchy that is rooted at the given base class, and includes a chain of all registered layers.
* <p/> * <p/>

View file

@ -38,7 +38,6 @@ import appeng.core.sync.packets.PacketLightning;
import appeng.core.sync.packets.PacketMEInventoryUpdate; import appeng.core.sync.packets.PacketMEInventoryUpdate;
import appeng.core.sync.packets.PacketMatterCannon; import appeng.core.sync.packets.PacketMatterCannon;
import appeng.core.sync.packets.PacketMockExplosion; import appeng.core.sync.packets.PacketMockExplosion;
import appeng.core.sync.packets.PacketMultiPart;
import appeng.core.sync.packets.PacketJEIRecipe; import appeng.core.sync.packets.PacketJEIRecipe;
import appeng.core.sync.packets.PacketNewStorageDimension; import appeng.core.sync.packets.PacketNewStorageDimension;
import appeng.core.sync.packets.PacketPaintedEntity; import appeng.core.sync.packets.PacketPaintedEntity;
@ -68,8 +67,6 @@ public class AppEngPacketHandlerBase
PACKET_CONFIG_BUTTON( PacketConfigButton.class ), PACKET_CONFIG_BUTTON( PacketConfigButton.class ),
PACKET_MULTIPART( PacketMultiPart.class ),
PACKET_PART_PLACEMENT( PacketPartPlacement.class ), PACKET_PART_PLACEMENT( PacketPartPlacement.class ),
PACKET_LIGHTNING( PacketLightning.class ), PACKET_LIGHTNING( PacketLightning.class ),

View file

@ -1,64 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.core.sync.packets;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.common.MinecraftForge;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IFMP;
public class PacketMultiPart extends AppEngPacket
{
// automatic.
public PacketMultiPart( final ByteBuf stream )
{
}
// api
public PacketMultiPart()
{
final ByteBuf data = Unpooled.buffer();
data.writeInt( this.getPacketID() );
this.configureWrite( data );
}
@Override
public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player )
{
final IFMP fmp = (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP );
if( fmp != null )
{
final EntityPlayerMP sender = (EntityPlayerMP) player;
MinecraftForge.EVENT_BUS.post( fmp.newFMPPacketEvent( sender ) ); // when received it just posts this event.
}
}
}

View file

@ -24,8 +24,6 @@ import java.util.Optional;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -35,9 +33,6 @@ import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IFacadePart; import appeng.api.parts.IFacadePart;
import appeng.api.parts.IPartHost; import appeng.api.parts.IPartHost;
import appeng.api.util.AEPartLocation; import appeng.api.util.AEPartLocation;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBuildCraftTransport;
import appeng.items.parts.ItemFacade; import appeng.items.parts.ItemFacade;
import appeng.parts.CableBusStorage; import appeng.parts.CableBusStorage;
@ -136,29 +131,16 @@ public class FacadeContainer implements IFacadeContainer
{ {
ids[0] = out.readInt(); ids[0] = out.readInt();
ids[1] = out.readInt(); ids[1] = out.readInt();
final boolean isBC = ids[0] < 0;
ids[0] = Math.abs( ids[0] ); ids[0] = Math.abs( ids[0] );
if( isBC && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) ) Optional<Item> maybeFacadeItem = AEApi.instance().definitions().items().facade().maybeItem();
{ if (maybeFacadeItem.isPresent()) {
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport ); final ItemFacade ifa = (ItemFacade) maybeFacadeItem.get();
final IBlockState state = Block.getStateById( ids[0] ); final ItemStack facade = ifa.createFromIDs( ids );
final IFacadePart created = bc.createFacadePart( state, side ); if( facade != null )
changed = changed || this.storage.getFacade( x ) == null; {
changed = changed || this.storage.getFacade( x ) == null;
this.storage.setFacade( x, created ); this.storage.setFacade( x, ifa.createPartFromItemStack( facade, side ) );
}
else if( !isBC )
{
Optional<Item> maybeFacadeItem = AEApi.instance().definitions().items().facade().maybeItem();
if (maybeFacadeItem.isPresent()) {
final ItemFacade ifa = (ItemFacade) maybeFacadeItem.get();
final ItemStack facade = ifa.createFromIDs( ids );
if( facade != null )
{
changed = changed || this.storage.getFacade( x ) == null;
this.storage.setFacade( x, ifa.createPartFromItemStack( facade, side ) );
}
} }
} }
} }
@ -190,17 +172,6 @@ public class FacadeContainer implements IFacadeContainer
{ {
this.storage.setFacade( x, ( (IFacadeItem) i ).createPartFromItemStack( is, AEPartLocation.fromOrdinal( x ) ) ); this.storage.setFacade( x, ( (IFacadeItem) i ).createPartFromItemStack( is, AEPartLocation.fromOrdinal( x ) ) );
} }
else
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
if( bc.isFacade( is ) )
{
this.storage.setFacade( x, bc.createFacadePart( is, AEPartLocation.fromOrdinal( x ) ) );
}
}
}
} }
} }
} }

View file

@ -21,7 +21,26 @@ package appeng.integration;
public interface IIntegrationModule public interface IIntegrationModule
{ {
void init() throws Throwable;
void postInit(); default boolean isEnabled()
{
return true;
}
default void init() throws Throwable
{
}
default void postInit()
{
}
class Stub implements IIntegrationModule
{
@Override
public boolean isEnabled()
{
return false;
}
}
} }

View file

@ -19,42 +19,38 @@
package appeng.integration; package appeng.integration;
import java.lang.reflect.Field;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModAPIManager; import net.minecraftforge.fml.common.ModAPIManager;
import appeng.api.exceptions.ModNotInstalled; import appeng.api.exceptions.ModNotInstalled;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.integration.modules.ic2.IC2Module;
import appeng.integration.modules.jei.JEIModule;
import appeng.integration.modules.waila.WailaModule;
public final class IntegrationNode final class IntegrationNode
{ {
private final String displayName; private final String displayName;
private final String modID; private final String modID;
private final IntegrationType shortName; private final IntegrationType type;
private IntegrationStage state = IntegrationStage.PRE_INIT; private IntegrationStage state = IntegrationStage.PRE_INIT;
private IntegrationStage failedStage = IntegrationStage.PRE_INIT;
private Throwable exception = null; private Throwable exception = null;
private String name = null;
private Class<?> classValue = null;
private Object instance;
private IIntegrationModule mod = null; private IIntegrationModule mod = null;
public IntegrationNode( final String displayName, final String modID, final IntegrationType shortName, final String name ) IntegrationNode( final String displayName, final String modID, final IntegrationType type )
{ {
this.displayName = displayName; this.displayName = displayName;
this.shortName = shortName; this.type = type;
this.modID = modID; this.modID = modID;
this.name = name;
} }
@Override @Override
public String toString() public String toString()
{ {
return this.getShortName().name() + ':' + this.getState().name(); return this.getType().name() + ':' + this.getState().name();
} }
boolean isActive() boolean isActive()
@ -98,10 +94,17 @@ public final class IntegrationNode
if( enabled ) if( enabled )
{ {
this.classValue = this.getClass().getClassLoader().loadClass( this.name ); switch (type) {
this.mod = (IIntegrationModule) this.classValue.getConstructor().newInstance(); case IC2:
final Field f = this.classValue.getField( "instance" ); this.mod = Integrations.ic2 = new IC2Module();
f.set( this.classValue, this.setInstance( this.mod ) ); break;
case JEI:
this.mod = Integrations.jei = new JEIModule();
break;
case Waila:
this.mod = new WailaModule();
break;
}
} }
else else
{ {
@ -128,7 +131,6 @@ public final class IntegrationNode
} }
catch( final Throwable t ) catch( final Throwable t )
{ {
this.failedStage = stage;
this.exception = t; this.exception = t;
this.setState( IntegrationStage.FAILED ); this.setState( IntegrationStage.FAILED );
} }
@ -151,20 +153,9 @@ public final class IntegrationNode
} }
} }
Object getInstance() IntegrationType getType()
{ {
return this.instance; return this.type;
}
private Object setInstance( final Object instance )
{
this.instance = instance;
return instance;
}
IntegrationType getShortName()
{
return this.shortName;
} }
IntegrationStage getState() IntegrationStage getState()

View file

@ -22,8 +22,6 @@ package appeng.integration;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedList; import java.util.LinkedList;
import javax.annotation.Nonnull;
import net.minecraftforge.fml.relauncher.FMLLaunchHandler; import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -32,8 +30,6 @@ public enum IntegrationRegistry
{ {
INSTANCE; INSTANCE;
private static final String PACKAGE_PREFIX = "appeng.integration.modules.";
private final Collection<IntegrationNode> modules = new LinkedList<IntegrationNode>(); private final Collection<IntegrationNode> modules = new LinkedList<IntegrationNode>();
public void add( final IntegrationType type ) public void add( final IntegrationType type )
@ -48,7 +44,7 @@ public enum IntegrationRegistry
return; return;
} }
this.modules.add( new IntegrationNode( type.dspName, type.modID, type, PACKAGE_PREFIX + type.name() ) ); this.modules.add( new IntegrationNode( type.dspName, type.modID, type ) );
} }
public void init() public void init()
@ -83,7 +79,7 @@ public enum IntegrationRegistry
builder.append( ", " ); builder.append( ", " );
} }
final String integrationState = node.getShortName() + ":" + ( node.getState() == IntegrationStage.FAILED ? "OFF" : "ON" ); final String integrationState = node.getType() + ":" + ( node.getState() == IntegrationStage.FAILED ? "OFF" : "ON" );
builder.append( integrationState ); builder.append( integrationState );
} }
@ -94,7 +90,7 @@ public enum IntegrationRegistry
{ {
for( final IntegrationNode node : this.modules ) for( final IntegrationNode node : this.modules )
{ {
if( node.getShortName() == name ) if( node.getType() == name )
{ {
return node.isActive(); return node.isActive();
} }
@ -102,18 +98,4 @@ public enum IntegrationRegistry
return false; return false;
} }
@Nonnull
public Object getInstance( final IntegrationType name )
{
for( final IntegrationNode node : this.modules )
{
if( node.getShortName() == name && node.isActive() )
{
return node.getInstance();
}
}
throw new IllegalStateException( "integration with " + name.name() + " is disabled." );
}
} }

View file

@ -19,7 +19,7 @@
package appeng.integration; package appeng.integration;
public enum IntegrationSide enum IntegrationSide
{ {
CLIENT, SERVER, BOTH CLIENT, SERVER, BOTH
} }

View file

@ -19,7 +19,7 @@
package appeng.integration; package appeng.integration;
public enum IntegrationStage enum IntegrationStage
{ {
PRE_INIT, INIT, POST_INIT, PRE_INIT, INIT, POST_INIT,

View file

@ -23,46 +23,22 @@ public enum IntegrationType
{ {
IC2( IntegrationSide.BOTH, "Industrial Craft 2", "IC2" ), IC2( IntegrationSide.BOTH, "Industrial Craft 2", "IC2" ),
RotaryCraft( IntegrationSide.BOTH, "Rotary Craft", "RotaryCraft" ),
RC( IntegrationSide.BOTH, "Railcraft", "Railcraft" ), RC( IntegrationSide.BOTH, "Railcraft", "Railcraft" ),
BuildCraftCore( IntegrationSide.BOTH, "BuildCraft Core", "BuildCraft|Core" ),
BuildCraftTransport( IntegrationSide.BOTH, "BuildCraft Transport", "BuildCraft|Transport" ),
BuildCraftBuilder( IntegrationSide.BOTH, "BuildCraft Builders", "BuildCraft|Builders" ),
RF( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", "CoFHAPI" ), RF( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", "CoFHAPI" ),
RFItem( IntegrationSide.BOTH, "RedstoneFlux Power - Items", "CoFHAPI" ), RFItem( IntegrationSide.BOTH, "RedstoneFlux Power - Items", "CoFHAPI" ),
MFR( IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded" ), MFR( IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded" ),
DSU( IntegrationSide.BOTH, "Deep Storage Unit", null ),
FZ( IntegrationSide.BOTH, "Factorization", "factorization" ),
FMP( IntegrationSide.BOTH, "Forge MultiPart", "McMultipart" ),
RB( IntegrationSide.BOTH, "Rotatable Blocks", "RotatableBlocks" ),
CLApi( IntegrationSide.BOTH, "Colored Lights Core", "coloredlightscore" ),
Waila( IntegrationSide.BOTH, "Waila", "Waila" ), Waila( IntegrationSide.BOTH, "Waila", "Waila" ),
InvTweaks( IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks" ), InvTweaks( IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks" ),
JEI( IntegrationSide.CLIENT, "Just Enough Items", "JEI" ), JEI( IntegrationSide.CLIENT, "Just Enough Items", "JEI" ),
CraftGuide( IntegrationSide.CLIENT, "Craft Guide", "craftguide" ),
Mekanism( IntegrationSide.BOTH, "Mekanism", "Mekanism" ), Mekanism( IntegrationSide.BOTH, "Mekanism", "Mekanism" ),
ImmibisMicroblocks( IntegrationSide.BOTH, "ImmibisMicroblocks", "ImmibisMicroblocks" ),
BetterStorage( IntegrationSide.BOTH, "BetterStorage", "betterstorage" ),
OpenComputers( IntegrationSide.BOTH, "OpenComputers", "OpenComputers" ); OpenComputers( IntegrationSide.BOTH, "OpenComputers", "OpenComputers" );
public final IntegrationSide side; public final IntegrationSide side;

View file

@ -0,0 +1,52 @@
package appeng.integration;
import appeng.integration.abstraction.IIC2;
import appeng.integration.abstraction.IInvTweaks;
import appeng.integration.abstraction.IJEI;
import appeng.integration.abstraction.IMekanism;
import appeng.integration.abstraction.IRC;
public final class Integrations
{
static IIC2 ic2 = new IIC2.Stub();
static IJEI jei = new IJEI.Stub();
static IRC rc = new IRC.Stub();
static IMekanism mekanism = new IMekanism.Stub();
static IInvTweaks invTweaks = new IInvTweaks.Stub();
private Integrations()
{
}
public static IIC2 ic2()
{
return ic2;
}
public static IJEI jei()
{
return jei;
}
public static IRC rc()
{
return rc;
}
public static IMekanism mekanism()
{
return mekanism;
}
public static IInvTweaks invTweaks()
{
return invTweaks;
}
}

View file

@ -1,33 +0,0 @@
/*
* 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.integration.abstraction;
import net.minecraft.util.EnumFacing;
import appeng.util.InventoryAdaptor;
public interface IBetterStorage
{
boolean isStorageCrate( Object te );
InventoryAdaptor getAdaptor( Object te, EnumFacing d );
}

View file

@ -1,71 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.abstraction;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.util.math.BlockPos;
/**
* Contains wrench behaviour
*
* and registers the engines as P2P attunements for RF tunnels (since BC 7, they are part of BC Core) The attunement is
* currently not public anymore, because it
* was only used internally
*
* @author AlgorithmX2
* @version rv3
* @since rv0
*/
public interface IBuildCraftCore
{
/**
* @param eq to be checked item, can be {@code null}
*
* @return {@code true} if it is an {@link buildcraft.api.tools.IToolWrench}
*/
boolean isWrench( @Nullable Item eq );
/**
* @param wrench to be checked item, must be an {@link buildcraft.api.tools.IToolWrench}
* @param wrencher wrenching player, can be probably {@code null}, but not sure
* @param pos pos
*
* @return {@code true} if player can wrench with that {@code wrench}
*
* @throws NullPointerException if {@code wrench} is {@code null}
* @throws ClassCastException if {@code wrench} is not an {@link buildcraft.api.tools.IToolWrench}
*/
boolean canWrench( @Nonnull Item wrench, EntityPlayer wrencher, BlockPos pos );
/**
* @param wrench to be checked item, must be an {@link buildcraft.api.tools.IToolWrench}
* @param wrencher wrenching player, can be probably {@code null}, but not sure
* @param pos pos
*
* @throws NullPointerException if {@code wrench} is {@code null}
* @throws ClassCastException if {@code wrench} is not an {@link buildcraft.api.tools.IToolWrench}
*/
void wrenchUsed( @Nonnull Item wrench, EntityPlayer wrencher, BlockPos pos );
}

View file

@ -1,117 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.abstraction;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import appeng.api.parts.IFacadePart;
import appeng.api.util.AEPartLocation;
/**
* Contains facade logic to interchange BC facades with AE facades,
*
* pipe logic to interact between storage buses and pipes
*
* and using pipes for attunements
* The attunement is currently not public anymore,
* because it was only used internally
*
* @author thatsIch
* @version rv3 - 12.06.2015
* @since rv3 12.06.2015
*/
public interface IBuildCraftTransport
{
/**
* @param is to be checked item
*
* @return {@code true} if the checked item is a {@link buildcraft.api.facades.IFacadeItem}
*/
boolean isFacade( @Nullable ItemStack is );
/**
* @param blk block used for the ae facade
* @param meta meta of the block
* @param side side of the ae facade
*
* @return ae facade through bc facade system
*/
@Nullable
IFacadePart createFacadePart( @Nullable IBlockState blk, @Nonnull AEPartLocation side );
/**
* @param held create facade for that item
* @param side on which side should the part be rendered, should rather be not {@code null}
*
* @return new instance using the {@code held} and side as direct argument, no logic in between
*
* @throws IllegalArgumentException if {@code held} is {@code null}
*/
IFacadePart createFacadePart( @Nonnull ItemStack held, @Nonnull AEPartLocation side );
/**
* @param facade buildcraft facade
*
* @return item with the block and metadata based on the facade or {@code null} if {@code facade} was not a facade
*
* @throws NullPointerException if {@code facade} is {@code null}
*/
@Nullable
ItemStack getTextureForFacade( @Nonnull ItemStack facade );
/**
* @param te the to be checked {@link TileEntity}
* @param dir direction of the {@link TileEntity}
*
* @return {@code true} if {@code te} is a buildcraft pipe, but not plugged
*
* @throws NullPointerException if {@code dir} is {@code null}
*/
boolean isPipe( @Nullable TileEntity te, @Nonnull EnumFacing dir );
/**
* checks weather if the {@code te} is injectable and simulates to inject the item
*
* @param te preferred something like a buildcraft injectable, can handle anything, just fails that way
* @param is to be injected item
* @param dir direction of the pipe
*
* @return {@code true} if items were simulated successfully being added
*/
boolean canAddItemsToPipe( TileEntity te, ItemStack is, EnumFacing dir );
/**
* checks weather if the {@code te} is injectable, simulates the inject and tries to inject the item
*
* @param te preferred something like a buildcraft injectable, can handle anything, just fails that way
* @param is to be injected item
* @param dir direction of the pipe
*
* @return {@code true} if items were added to the buildcraft pipe
*/
boolean addItemsToPipe( @Nullable TileEntity te, @Nullable ItemStack is, @Nonnull EnumFacing dir );
}

View file

@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>. * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/ */
package appeng.integration.modules.ic2; package appeng.integration.abstraction;
import java.util.Set; import java.util.Set;

View file

@ -1,29 +0,0 @@
/*
* 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.integration.abstraction;
import appeng.api.util.AEColor;
public interface ICLApi
{
int colorLight( AEColor color, int light );
}

View file

@ -1,33 +0,0 @@
/*
* 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.integration.abstraction;
import net.minecraft.tileentity.TileEntity;
import appeng.api.storage.IMEInventory;
public interface IDSU
{
IMEInventory getDSU( TileEntity te );
boolean isDSU( TileEntity te );
}

View file

@ -1,40 +0,0 @@
/*
* 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.integration.abstraction;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fml.common.eventhandler.Event;
import appeng.api.parts.IPartHost;
import appeng.parts.CableBusContainer;
public interface IFMP
{
IPartHost getOrCreateHost( TileEntity tile );
CableBusContainer getCableContainer( TileEntity te );
void registerPassThrough( Class<?> layerInterface );
Event newFMPPacketEvent( EntityPlayerMP sender );
}

View file

@ -1,46 +0,0 @@
/*
* 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.integration.abstraction;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import appeng.api.storage.IMEInventory;
public interface IFZ
{
ItemStack barrelGetItem( TileEntity te );
int barrelGetMaxItemCount( TileEntity te );
int barrelGetItemCount( TileEntity te );
void setItemType( TileEntity te, ItemStack input );
void barrelSetCount( TileEntity te, int max );
IMEInventory getFactorizationBarrel( TileEntity te );
boolean isBarrel( TileEntity te );
void grinderRecipe( ItemStack is, ItemStack itemStack );
}

View file

@ -1,29 +0,0 @@
/*
* 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.integration.abstraction;
import appeng.api.features.IItemComparisonProvider;
public interface IForestry
{
IItemComparisonProvider getGeneticsComparisonProvider();
}

View file

@ -1,33 +0,0 @@
/*
* 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.integration.abstraction;
import net.minecraft.tileentity.TileEntity;
import appeng.api.storage.IMEInventory;
public interface IGT
{
boolean isQuantumChest( TileEntity te );
IMEInventory getQuantumChest( TileEntity te );
}

View file

@ -20,11 +20,29 @@ package appeng.integration.abstraction;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import appeng.integration.IIntegrationModule;
import appeng.integration.modules.ic2.IC2PowerSinkStub;
import appeng.tile.powersink.IExternalPowerSink;
public interface IIC2 public interface IIC2 extends IIntegrationModule
{ {
void maceratorRecipe( ItemStack in, ItemStack out ); default void maceratorRecipe( ItemStack in, ItemStack out )
{
}
/**
* Create an IC2 power sink for the given external sink.
*/
default IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink ) {
return IC2PowerSinkStub.INSTANCE;
}
class Stub extends IIntegrationModule.Stub implements IIC2
{
}
} }

View file

@ -1,39 +0,0 @@
/*
* 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.integration.abstraction;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import appeng.api.parts.IPartHost;
public interface IImmibisMicroblocks
{
IPartHost getOrCreateHost( EntityPlayer player, int side, TileEntity te );
/**
* @param te to be left tile entity
*
* @return true if this worked..
*/
boolean leaveParts( TileEntity te );
}

View file

@ -21,9 +21,19 @@ package appeng.integration.abstraction;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.integration.IIntegrationModule;
public interface IInvTweaks
public interface IInvTweaks extends IIntegrationModule
{ {
int compareItems( ItemStack i, ItemStack j ); default int compareItems( ItemStack i, ItemStack j )
{
throw new UnsupportedOperationException();
}
class Stub extends IIntegrationModule.Stub implements IInvTweaks
{
}
} }

View file

@ -1,15 +1,25 @@
package appeng.integration.abstraction; package appeng.integration.abstraction;
import appeng.integration.IIntegrationModule;
/** /**
* Abstracts access to the JEI API functionality. * Abstracts access to the JEI API functionality.
*/ */
public interface IJEI public interface IJEI extends IIntegrationModule
{ {
boolean isEnabled(); default String getSearchText()
{
return "";
}
String getSearchText(); default void setSearchText( String searchText )
{
}
void setSearchText( String searchText ); class Stub extends IIntegrationModule.Stub implements IJEI
{
}
} }

View file

@ -1,50 +0,0 @@
/*
* 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.integration.abstraction;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import appeng.api.storage.IMEInventory;
public interface ILP
{
List<ItemStack> getCraftedItems( TileEntity te );
List<ItemStack> getProvidedItems( TileEntity te );
boolean isRequestPipe( TileEntity te );
List<ItemStack> performRequest( TileEntity te, ItemStack wanted );
IMEInventory getInv( TileEntity te );
Object getGetPowerPipe( TileEntity te );
boolean isPowerSource( TileEntity tt );
boolean canUseEnergy( Object pp, int ceil, List<Object> providersToIgnore );
boolean useEnergy( Object pp, int ceil, List<Object> providersToIgnore );
}

View file

@ -21,11 +21,21 @@ package appeng.integration.abstraction;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.integration.IIntegrationModule;
public interface IMekanism
public interface IMekanism extends IIntegrationModule
{ {
void addCrusherRecipe( ItemStack in, ItemStack out ); default void addCrusherRecipe( ItemStack in, ItemStack out )
{
}
void addEnrichmentChamberRecipe( ItemStack in, ItemStack out ); default void addEnrichmentChamberRecipe( ItemStack in, ItemStack out )
{
}
class Stub extends IIntegrationModule.Stub implements IMekanism
{
}
} }

View file

@ -21,9 +21,16 @@ package appeng.integration.abstraction;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.integration.IIntegrationModule;
public interface IRC
public interface IRC extends IIntegrationModule
{ {
void rockCrusher( ItemStack input, ItemStack output ); default void rockCrusher( ItemStack input, ItemStack output ) {
}
class Stub extends IIntegrationModule.Stub implements IRC {
}
} }

View file

@ -1,38 +0,0 @@
/*
* 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.integration.abstraction;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import appeng.api.util.AEPartLocation;
public interface ITE
{
void addPulverizerRecipe( int i, ItemStack blkQuartz, ItemStack blockDust );
void addPulverizerRecipe( int i, ItemStack blkQuartzOre, ItemStack matQuartz, ItemStack matQuartzDust );
boolean isPipe( TileEntity te, AEPartLocation opposite );
ItemStack addItemsToPipe( TileEntity ad, ItemStack itemstack, AEPartLocation dir );
}

View file

@ -1,40 +0,0 @@
package appeng.integration.modules;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.abstraction.IJEI;
import appeng.integration.modules.jei.NullJEI;
public class JEI implements IIntegrationModule
{
@Reflected
public static JEI instance;
private IJEI jei = new NullJEI();
@Override
public void init() throws Throwable
{
}
@Override
public void postInit()
{
}
public void setJei( IJEI jei )
{
this.jei = jei;
}
public IJEI getJei()
{
return jei;
}
}

View file

@ -16,11 +16,9 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>. * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/ */
package appeng.integration.modules; package appeng.integration.modules.ic2;
import java.util.function.BiFunction;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -29,36 +27,21 @@ import ic2.api.recipe.RecipeInputItemStack;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.TunnelType; import appeng.api.config.TunnelType;
import appeng.api.features.IP2PTunnelRegistry; import appeng.api.features.IP2PTunnelRegistry;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper; import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.IC2PowerSink;
import appeng.integration.abstraction.IIC2; import appeng.integration.abstraction.IIC2;
import appeng.integration.modules.ic2.IC2PowerSink;
import appeng.integration.modules.ic2.IC2PowerSinkAdapter;
import appeng.integration.modules.ic2.IC2PowerSinkStub;
import appeng.tile.powersink.IExternalPowerSink; import appeng.tile.powersink.IExternalPowerSink;
public class IC2 implements IIntegrationModule, IIC2 public class IC2Module implements IIC2
{ {
@Reflected public IC2Module()
public static IC2 instance;
public IC2()
{ {
IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class ); IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class );
IntegrationHelper.testClassExistence( this, ic2.api.recipe.RecipeInputItemStack.class ); IntegrationHelper.testClassExistence( this, ic2.api.recipe.RecipeInputItemStack.class );
} }
private static BiFunction<TileEntity, IExternalPowerSink, IC2PowerSink> powerSinkFactory = ( ( te, sink ) -> IC2PowerSinkStub.INSTANCE );
@Override
public void init() throws Throwable
{
powerSinkFactory = IC2PowerSinkAdapter::new;
}
@Override @Override
public void postInit() public void postInit()
{ {
@ -76,7 +59,7 @@ public class IC2 implements IIntegrationModule, IIC2
reg.addNewAttunement( this.getItem( "splitterCableItem" ), TunnelType.IC2_POWER ); reg.addNewAttunement( this.getItem( "splitterCableItem" ), TunnelType.IC2_POWER );
} }
public ItemStack getItem( final String name ) private ItemStack getItem( final String name )
{ {
return ic2.api.item.IC2Items.getItem( name ); return ic2.api.item.IC2Items.getItem( name );
} }
@ -84,9 +67,10 @@ public class IC2 implements IIntegrationModule, IIC2
/** /**
* Create an IC2 power sink for the given external sink. * Create an IC2 power sink for the given external sink.
*/ */
public static IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink ) @Override
public IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink )
{ {
return powerSinkFactory.apply( tileEntity, externalSink ); return new IC2PowerSinkAdapter( tileEntity, externalSink );
} }
@Override @Override
@ -94,5 +78,4 @@ public class IC2 implements IIntegrationModule, IIC2
{ {
ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, false, out ); ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, false, out );
} }
} }

View file

@ -29,6 +29,7 @@ import ic2.api.energy.prefab.BasicSink;
import ic2.api.energy.tile.IEnergyEmitter; import ic2.api.energy.tile.IEnergyEmitter;
import appeng.api.config.PowerUnits; import appeng.api.config.PowerUnits;
import appeng.integration.abstraction.IC2PowerSink;
import appeng.tile.powersink.IExternalPowerSink; import appeng.tile.powersink.IExternalPowerSink;

View file

@ -19,6 +19,9 @@
package appeng.integration.modules.ic2; package appeng.integration.modules.ic2;
import appeng.integration.abstraction.IC2PowerSink;
/** /**
* Implementation of IC2PowerSink that just stubs out all methods and does nothing. * Implementation of IC2PowerSink that just stubs out all methods and does nothing.
*/ */

View file

@ -4,22 +4,37 @@ package appeng.integration.modules.jei;
import appeng.integration.abstraction.IJEI; import appeng.integration.abstraction.IJEI;
public class NullJEI implements IJEI public class JEIModule implements IJEI
{ {
private IJEI jei = new IJEI.Stub();
public void setJei( IJEI jei )
{
this.jei = jei;
}
public IJEI getJei()
{
return jei;
}
@Override
public String getSearchText()
{
return jei.getSearchText();
}
@Override
public void setSearchText( String searchText )
{
jei.setSearchText( searchText );
}
@Override @Override
public boolean isEnabled() public boolean isEnabled()
{ {
return false; return false;
} }
@Override
public String getSearchText()
{
return "";
}
@Override
public void setSearchText( String searchText )
{
}
} }

View file

@ -26,9 +26,7 @@ import appeng.container.implementations.ContainerPatternTerm;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText; import appeng.core.localization.GuiText;
import appeng.integration.IntegrationRegistry; import appeng.integration.Integrations;
import appeng.integration.IntegrationType;
import appeng.integration.modules.JEI;
import appeng.items.parts.ItemFacade; import appeng.items.parts.ItemFacade;
@ -180,7 +178,7 @@ public class JEIPlugin extends BlankModPlugin
@Override @Override
public void onRuntimeAvailable( IJeiRuntime jeiRuntime ) public void onRuntimeAvailable( IJeiRuntime jeiRuntime )
{ {
JEI jeiModule = (JEI) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.JEI ); JEIModule jeiModule = (JEIModule) Integrations.jei();
jeiModule.setJei( new JeiRuntimeAdapter( jeiRuntime ) ); jeiModule.setJei( new JeiRuntimeAdapter( jeiRuntime ) );
} }
} }

View file

@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>. * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/ */
package appeng.integration.modules; package appeng.integration.modules.waila;
import net.minecraftforge.fml.common.event.FMLInterModComms; import net.minecraftforge.fml.common.event.FMLInterModComms;
@ -24,21 +24,15 @@ import net.minecraftforge.fml.common.event.FMLInterModComms;
import mcp.mobius.waila.api.IWailaDataProvider; import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar; import mcp.mobius.waila.api.IWailaRegistrar;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule; import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper; import appeng.integration.IntegrationHelper;
import appeng.integration.modules.waila.PartWailaDataProvider;
import appeng.integration.modules.waila.TileWailaDataProvider;
import appeng.tile.AEBaseTile; import appeng.tile.AEBaseTile;
public class Waila implements IIntegrationModule public class WailaModule implements IIntegrationModule
{ {
@Reflected
public static Waila instance;
@Reflected public WailaModule()
public Waila()
{ {
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataProvider.class ); IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataProvider.class );
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaRegistrar.class ); IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaRegistrar.class );
@ -67,8 +61,4 @@ public class Waila implements IIntegrationModule
FMLInterModComms.sendMessage( "Waila", "register", this.getClass().getName() + ".register" ); FMLInterModComms.sendMessage( "Waila", "register", this.getClass().getName() + ".register" );
} }
@Override
public void postInit()
{
}
} }

View file

@ -70,9 +70,6 @@ import appeng.client.render.cablebus.FacadeRenderState;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.facade.FacadeContainer; import appeng.facade.FacadeContainer;
import appeng.helpers.AEMultiTile; import appeng.helpers.AEMultiTile;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.ICLApi;
import appeng.me.GridConnection; import appeng.me.GridConnection;
import appeng.parts.networking.PartCable; import appeng.parts.networking.PartCable;
import appeng.util.Platform; import appeng.util.Platform;
@ -904,11 +901,6 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
} }
} }
if( light > 0 && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.CLApi ) )
{
return ( (ICLApi) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.CLApi ) ).colorLight( this.getColor(), light );
}
return light; return light;
} }

View file

@ -60,10 +60,6 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketClick; import appeng.core.sync.packets.PacketClick;
import appeng.core.sync.packets.PacketPartPlacement; import appeng.core.sync.packets.PacketPartPlacement;
import appeng.facade.IFacadeItem; import appeng.facade.IFacadeItem;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBuildCraftTransport;
import appeng.integration.abstraction.IFMP;
import appeng.util.LookDirection; import appeng.util.LookDirection;
import appeng.util.Platform; import appeng.util.Platform;
@ -198,22 +194,6 @@ public class PartPlacement
} }
} }
// TODO: IFMP INTEGRATION
// TODO IIMMIBISMICROBLOCKS INTEGRATION
/*
* if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
* {
* host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile );
* }
* if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled(
* IntegrationType.ImmibisMicroblocks ) )
* {
* host = ( (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.ImmibisMicroblocks )
* ).getOrCreateHost( player, face, tile );
* }
*/
// if ( held == null ) // if ( held == null )
{ {
final Block block = world.getBlockState( pos ).getBlock(); final Block block = world.getBlockState( pos ).getBlock();
@ -271,23 +251,6 @@ public class PartPlacement
host = (IPartHost) tile; host = (IPartHost) tile;
} }
// TODO: IFMP INTEGRATION
// TODO IIMMIBISMICROBLOCKS INTEGRATION
/*
* if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
* {
* host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile
* );
* }
* if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled(
* IntegrationType.ImmibisMicroblocks ) )
* {
* host = ( (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance(
* IntegrationType.ImmibisMicroblocks ) ).getOrCreateHost( player, side, tile );
* }
*/
final Optional<ItemStack> maybeMultiPartStack = multiPart.maybeStack( 1 ); final Optional<ItemStack> maybeMultiPartStack = multiPart.maybeStack( 1 );
final Optional<Block> maybeMultiPartBlock = multiPart.maybeBlock(); final Optional<Block> maybeMultiPartBlock = multiPart.maybeBlock();
final Optional<ItemBlock> maybeMultiPartItemBlock = multiPart.maybeItemBlock(); final Optional<ItemBlock> maybeMultiPartItemBlock = multiPart.maybeItemBlock();
@ -336,11 +299,6 @@ public class PartPlacement
final Block blkID = world.getBlockState( te_pos ).getBlock(); final Block blkID = world.getBlockState( te_pos ).getBlock();
tile = world.getTileEntity( te_pos ); tile = world.getTileEntity( te_pos );
if( tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
{
host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile );
}
if( ( blkID == null || blkID.isReplaceable( world, te_pos ) || host != null ) ) // /&& side != if( ( blkID == null || blkID.isReplaceable( world, te_pos ) || host != null ) ) // /&& side !=
// AEPartLocation.INTERNAL // AEPartLocation.INTERNAL
// ) // )
@ -429,15 +387,6 @@ public class PartPlacement
return ( (IFacadeItem) held.getItem() ).createPartFromItemStack( held, side ); return ( (IFacadeItem) held.getItem() ).createPartFromItemStack( held, side );
} }
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
if( bc.isFacade( held ) )
{
return bc.createFacadePart( held, side );
}
}
return null; return null;
} }

View file

@ -41,15 +41,11 @@ import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation; import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest; import appeng.api.networking.ticking.TickingRequest;
import appeng.core.settings.TickRates; import appeng.core.settings.TickRates;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBuildCraftTransport;
import appeng.items.parts.PartModels; import appeng.items.parts.PartModels;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
import appeng.me.cache.helpers.TunnelCollection; import appeng.me.cache.helpers.TunnelCollection;
import appeng.tile.inventory.AppEngNullInventory; import appeng.tile.inventory.AppEngNullInventory;
import appeng.util.Platform; import appeng.util.Platform;
import appeng.util.inv.WrapperBCPipe;
import appeng.util.inv.WrapperChainedInventory; import appeng.util.inv.WrapperChainedInventory;
import appeng.util.inv.WrapperMCISidedInventory; import appeng.util.inv.WrapperMCISidedInventory;
@ -143,27 +139,6 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements /* IPip
this.which.add( this ); this.which.add( this );
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
final IBuildCraftTransport buildcraft = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
if( buildcraft.isPipe( te, this.getSide().getOpposite().getFacing() ) )
{
try
{
output = new WrapperBCPipe( te, this.getSide().getFacing().getOpposite() );
}
catch( final Throwable ignore )
{
}
}
}
/*
* if ( AppEng.INSTANCE.isIntegrationEnabled( "TE" ) ) { ITE thermal = (ITE) AppEng.INSTANCE.getIntegration(
* "TE" ); if ( thermal != null ) { if ( thermal.isPipe( te, side.getOpposite() ) ) { try { output = new
* WrapperTEPipe( te, side.getOpposite() ); } catch (Throwable ignore) { } } } }
*/
if( output == null ) if( output == null )
{ {
if( te instanceof TileEntityChest ) if( te instanceof TileEntityChest )

View file

@ -29,8 +29,7 @@ import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.ICraftHandler; import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient; import appeng.api.recipes.IIngredient;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.integration.IntegrationRegistry; import appeng.integration.Integrations;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IRC; import appeng.integration.abstraction.IRC;
import appeng.recipes.RecipeHandler; import appeng.recipes.RecipeHandler;
import appeng.util.Platform; import appeng.util.Platform;
@ -61,19 +60,16 @@ public class Crusher implements ICraftHandler, IWebsiteSerializer
@Override @Override
public void register() throws RegistrationError, MissingIngredientError public void register() throws RegistrationError, MissingIngredientError
{ {
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.RC ) ) final IRC rc = Integrations.rc();
for( final ItemStack is : this.pro_input.getItemStackSet() )
{ {
final IRC rc = (IRC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.RC ); try
for( final ItemStack is : this.pro_input.getItemStackSet() )
{ {
try rc.rockCrusher( is, this.pro_output[0].getItemStack() );
{ }
rc.rockCrusher( is, this.pro_output[0].getItemStack() ); catch( final java.lang.RuntimeException err )
} {
catch( final java.lang.RuntimeException err ) AELog.info( "RC not happy - " + err.getMessage() );
{
AELog.info( "RC not happy - " + err.getMessage() );
}
} }
} }
} }

View file

@ -1,92 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient;
import appeng.core.AELog;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IFZ;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
public class GrindFZ implements ICraftHandler, IWebsiteSerializer
{
private IIngredient pro_input;
private IIngredient[] pro_output;
@Override
public void setup( final List<List<IIngredient>> input, final List<List<IIngredient>> output ) throws RecipeError
{
if( input.size() == 1 && output.size() == 1 )
{
final int outs = output.get( 0 ).size();
if( input.get( 0 ).size() == 1 && outs == 1 )
{
this.pro_input = input.get( 0 ).get( 0 );
this.pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
return;
}
}
throw new RecipeError( "Grind must have a single input, and single output." );
}
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FZ ) )
{
final IFZ fz = (IFZ) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FZ );
for( final ItemStack is : this.pro_input.getItemStackSet() )
{
try
{
fz.grinderRecipe( is, this.pro_output[0].getItemStack() );
}
catch( final java.lang.RuntimeException err )
{
AELog.info( "FZ not happy - " + err.getMessage() );
}
}
}
}
@Override
public String getPattern( final RecipeHandler h )
{
return null;
}
@Override
public boolean canCraft( final ItemStack output ) throws RegistrationError, MissingIngredientError
{
return Platform.itemComparisons().isSameItem( this.pro_output[0].getItemStack(), output );
}
}

View file

@ -29,8 +29,7 @@ import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.ICraftHandler; import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient; import appeng.api.recipes.IIngredient;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.integration.IntegrationRegistry; import appeng.integration.Integrations;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IIC2; import appeng.integration.abstraction.IIC2;
import appeng.recipes.RecipeHandler; import appeng.recipes.RecipeHandler;
import appeng.util.Platform; import appeng.util.Platform;
@ -61,19 +60,16 @@ public class Macerator implements ICraftHandler, IWebsiteSerializer
@Override @Override
public void register() throws RegistrationError, MissingIngredientError public void register() throws RegistrationError, MissingIngredientError
{ {
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) ) IIC2 ic2 = Integrations.ic2();
for( final ItemStack is : this.pro_input.getItemStackSet() )
{ {
final IIC2 ic2 = (IIC2) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.IC2 ); try
for( final ItemStack is : this.pro_input.getItemStackSet() )
{ {
try ic2.maceratorRecipe( is, this.pro_output[0].getItemStack() );
{ }
ic2.maceratorRecipe( is, this.pro_output[0].getItemStack() ); catch( final java.lang.RuntimeException err )
} {
catch( final java.lang.RuntimeException err ) AELog.info( "IC2 not happy - " + err.getMessage() );
{
AELog.info( "IC2 not happy - " + err.getMessage() );
}
} }
} }
} }

View file

@ -29,8 +29,7 @@ import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.ICraftHandler; import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient; import appeng.api.recipes.IIngredient;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.integration.IntegrationRegistry; import appeng.integration.Integrations;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IMekanism; import appeng.integration.abstraction.IMekanism;
import appeng.recipes.RecipeHandler; import appeng.recipes.RecipeHandler;
import appeng.util.Platform; import appeng.util.Platform;
@ -62,19 +61,16 @@ public class MekCrusher implements ICraftHandler, IWebsiteSerializer
@Override @Override
public void register() throws RegistrationError, MissingIngredientError public void register() throws RegistrationError, MissingIngredientError
{ {
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.Mekanism ) ) IMekanism mekanism = Integrations.mekanism();
for( final ItemStack is : this.pro_input.getItemStackSet() )
{ {
final IMekanism rc = (IMekanism) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.Mekanism ); try
for( final ItemStack is : this.pro_input.getItemStackSet() )
{ {
try mekanism.addCrusherRecipe( is, this.pro_output[0].getItemStack() );
{ }
rc.addCrusherRecipe( is, this.pro_output[0].getItemStack() ); catch( final java.lang.RuntimeException err )
} {
catch( final java.lang.RuntimeException err ) AELog.info( "Mekanism not happy - " + err.getMessage() );
{
AELog.info( "Mekanism not happy - " + err.getMessage() );
}
} }
} }
} }

View file

@ -29,8 +29,7 @@ import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.ICraftHandler; import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient; import appeng.api.recipes.IIngredient;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.integration.IntegrationRegistry; import appeng.integration.Integrations;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IMekanism; import appeng.integration.abstraction.IMekanism;
import appeng.recipes.RecipeHandler; import appeng.recipes.RecipeHandler;
import appeng.util.Platform; import appeng.util.Platform;
@ -61,19 +60,16 @@ public class MekEnrichment implements ICraftHandler, IWebsiteSerializer
@Override @Override
public void register() throws RegistrationError, MissingIngredientError public void register() throws RegistrationError, MissingIngredientError
{ {
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.Mekanism ) ) IMekanism mekanism = Integrations.mekanism();
for( final ItemStack is : this.pro_input.getItemStackSet() )
{ {
final IMekanism rc = (IMekanism) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.Mekanism ); try
for( final ItemStack is : this.pro_input.getItemStackSet() )
{ {
try mekanism.addEnrichmentChamberRecipe( is, this.pro_output[0].getItemStack() );
{ }
rc.addEnrichmentChamberRecipe( is, this.pro_output[0].getItemStack() ); catch( final java.lang.RuntimeException err )
} {
catch( final java.lang.RuntimeException err ) AELog.info( "Mekanism not happy - " + err.getMessage() );
{
AELog.info( "Mekanism not happy - " + err.getMessage() );
}
} }
} }
} }

View file

@ -47,13 +47,9 @@ import appeng.api.networking.crafting.ICraftingProviderHelper;
import appeng.api.networking.events.MENetworkChannelsChanged; import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkEventSubscribe; import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange; import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.ticking.IGridTickable; import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation; import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest; import appeng.api.networking.ticking.TickingRequest;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.AECableType; import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation; import appeng.api.util.AEPartLocation;

View file

@ -51,9 +51,6 @@ import appeng.block.networking.BlockCableBus;
import appeng.helpers.AEMultiTile; import appeng.helpers.AEMultiTile;
import appeng.helpers.ICustomCollision; import appeng.helpers.ICustomCollision;
import appeng.hooks.TickHandler; import appeng.hooks.TickHandler;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IImmibisMicroblocks;
import appeng.parts.CableBusContainer; import appeng.parts.CableBusContainer;
import appeng.tile.AEBaseTile; import appeng.tile.AEBaseTile;
import appeng.tile.TileEvent; import appeng.tile.TileEvent;
@ -341,15 +338,6 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
@Override @Override
public void cleanup() public void cleanup()
{ {
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.ImmibisMicroblocks ) )
{
final IImmibisMicroblocks imb = (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.ImmibisMicroblocks );
if( imb != null && imb.leaveParts( this ) )
{
return;
}
}
this.getWorld().setBlockToAir( this.pos ); this.getWorld().setBlockToAir( this.pos );
} }

View file

@ -35,8 +35,8 @@ import appeng.api.config.PowerUnits;
import appeng.api.networking.energy.IAEPowerStorage; import appeng.api.networking.energy.IAEPowerStorage;
import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType; import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType;
import appeng.capabilities.Capabilities; import appeng.capabilities.Capabilities;
import appeng.integration.modules.IC2; import appeng.integration.Integrations;
import appeng.integration.modules.ic2.IC2PowerSink; import appeng.integration.abstraction.IC2PowerSink;
import appeng.tile.AEBaseInvTile; import appeng.tile.AEBaseInvTile;
import appeng.tile.TileEvent; import appeng.tile.TileEvent;
import appeng.tile.events.TileEventType; import appeng.tile.events.TileEventType;
@ -65,7 +65,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
{ {
teslaEnergyAdapter = new TeslaEnergyAdapter( this ); teslaEnergyAdapter = new TeslaEnergyAdapter( this );
} }
ic2Sink = IC2.createPowerSink( this, this ); ic2Sink = Integrations.ic2().createPowerSink( this, this );
ic2Sink.setValidFaces( internalPowerSides ); ic2Sink.setValidFaces( internalPowerSides );
} }

View file

@ -32,9 +32,6 @@ import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBetterStorage;
import appeng.util.inv.AdaptorIInventory; import appeng.util.inv.AdaptorIInventory;
import appeng.util.inv.AdaptorItemHandler; import appeng.util.inv.AdaptorItemHandler;
import appeng.util.inv.AdaptorList; import appeng.util.inv.AdaptorList;
@ -71,8 +68,6 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
} }
} }
final IBetterStorage bs = (IBetterStorage) ( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BetterStorage ) ? IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BetterStorage ) : null );
if( te instanceof EntityPlayer ) if( te instanceof EntityPlayer )
{ {
return new AdaptorIInventory( new AdaptorPlayerInventory( ( (EntityPlayer) te ).inventory, false ) ); return new AdaptorIInventory( new AdaptorPlayerInventory( ( (EntityPlayer) te ).inventory, false ) );
@ -84,10 +79,6 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
return new AdaptorList( list ); return new AdaptorList( list );
} }
else if( bs != null && bs.isStorageCrate( te ) )
{
return bs.getAdaptor( te, d );
}
else if( te instanceof TileEntityChest ) else if( te instanceof TileEntityChest )
{ {
return new AdaptorIInventory( Platform.GetChestInv( te ) ); return new AdaptorIInventory( Platform.GetChestInv( te ) );

View file

@ -23,8 +23,7 @@ import java.util.Comparator;
import appeng.api.config.SortDir; import appeng.api.config.SortDir;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import appeng.integration.IntegrationRegistry; import appeng.integration.Integrations;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IInvTweaks; import appeng.integration.abstraction.IInvTweaks;
import appeng.util.item.AEItemStack; import appeng.util.item.AEItemStack;
@ -111,9 +110,9 @@ public class ItemSorters
return; return;
} }
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.InvTweaks ) ) if( Integrations.invTweaks().isEnabled() )
{ {
api = (IInvTweaks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.InvTweaks ); api = Integrations.invTweaks();
} }
else else
{ {

View file

@ -30,7 +30,6 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -126,8 +125,7 @@ import appeng.core.stats.Stats;
import appeng.core.sync.GuiBridge; import appeng.core.sync.GuiBridge;
import appeng.core.sync.GuiHostType; import appeng.core.sync.GuiHostType;
import appeng.hooks.TickHandler; import appeng.hooks.TickHandler;
import appeng.integration.IntegrationRegistry; import appeng.integration.Integrations;
import appeng.integration.IntegrationType;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
import appeng.me.GridNode; import appeng.me.GridNode;
import appeng.me.helpers.AENetworkProxy; import appeng.me.helpers.AENetworkProxy;
@ -344,17 +342,17 @@ public class Platform
private static boolean isNotValidSetting( final Enum e ) private static boolean isNotValidSetting( final Enum e )
{ {
if( e == SortOrder.INVTWEAKS && !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.InvTweaks ) ) if( e == SortOrder.INVTWEAKS && !Integrations.invTweaks().isEnabled() )
{ {
return true; return true;
} }
if( e == SearchBoxMode.JEI_AUTOSEARCH && !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.JEI ) ) if( e == SearchBoxMode.JEI_AUTOSEARCH && !Integrations.jei().isEnabled() )
{ {
return true; return true;
} }
if( e == SearchBoxMode.JEI_MANUAL_SEARCH && !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.JEI ) ) if( e == SearchBoxMode.JEI_MANUAL_SEARCH && !Integrations.jei().isEnabled() )
{ {
return true; return true;
} }

View file

@ -1,157 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.util.inv;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.ITextComponent;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBuildCraftTransport;
public class WrapperBCPipe implements IInventory
{
private final IBuildCraftTransport bc;
private final TileEntity ad;
private final EnumFacing dir;
public WrapperBCPipe( final TileEntity te, final EnumFacing d )
{
this.bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
this.ad = te;
this.dir = d;
}
@Override
public int getSizeInventory()
{
return 1;
}
@Override
public ItemStack getStackInSlot( final int i )
{
return null;
}
@Override
public ItemStack decrStackSize( final int i, final int j )
{
return null;
}
@Override
public ItemStack removeStackFromSlot( final int i )
{
return null;
}
@Override
public void setInventorySlotContents( final int i, final ItemStack itemstack )
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
this.bc.addItemsToPipe( this.ad, itemstack, this.dir );
}
}
@Override
public int getInventoryStackLimit()
{
return 64;
}
@Override
public void markDirty()
{
}
@Override
public void openInventory( final EntityPlayer player )
{
}
@Override
public void closeInventory( final EntityPlayer player )
{
}
@Override
public boolean isUseableByPlayer( final EntityPlayer entityplayer )
{
return false;
}
@Override
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return this.bc.canAddItemsToPipe( this.ad, itemstack, this.dir );
}
@Override
public int getField( final int id )
{
return 0;
}
@Override
public void setField( final int id, final int value )
{
}
@Override
public int getFieldCount()
{
return 0;
}
@Override
public void clear()
{
}
@Override
public String getName()
{
return null;
}
@Override
public boolean hasCustomName()
{
return false;
}
@Override
public ITextComponent getDisplayName()
{
return null;
}
}