diff --git a/src/main/java/appeng/block/networking/BlockCableBus.java b/src/main/java/appeng/block/networking/BlockCableBus.java index 8ea58f8e..0f923a1a 100644 --- a/src/main/java/appeng/block/networking/BlockCableBus.java +++ b/src/main/java/appeng/block/networking/BlockCableBus.java @@ -69,9 +69,6 @@ import appeng.client.render.cablebus.CableBusRenderState; import appeng.core.Api; import appeng.core.AppEng; import appeng.helpers.AEGlassMaterial; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; -import appeng.integration.abstraction.IFMP; import appeng.parts.ICableBusContainer; import appeng.parts.NullCableBusContainer; import appeng.tile.AEBaseTile; @@ -349,10 +346,6 @@ public class BlockCableBus extends AEBaseTileBlock { 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; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiSkyChest.java b/src/main/java/appeng/client/gui/implementations/GuiSkyChest.java index 7de9aafa..cbf4ea21 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiSkyChest.java +++ b/src/main/java/appeng/client/gui/implementations/GuiSkyChest.java @@ -24,8 +24,7 @@ import net.minecraft.entity.player.InventoryPlayer; import appeng.client.gui.AEBaseGui; import appeng.container.implementations.ContainerSkyChest; import appeng.core.localization.GuiText; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; +import appeng.integration.Integrations; import appeng.tile.storage.TileSkyChest; @@ -55,6 +54,6 @@ public class GuiSkyChest extends AEBaseGui @Override protected boolean enableSpaceClicking() { - return !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.InvTweaks ); + return !Integrations.invTweaks().isEnabled(); } } diff --git a/src/main/java/appeng/client/me/ItemRepo.java b/src/main/java/appeng/client/me/ItemRepo.java index dea8c3f7..a0b373a5 100644 --- a/src/main/java/appeng/client/me/ItemRepo.java +++ b/src/main/java/appeng/client/me/ItemRepo.java @@ -37,7 +37,7 @@ import appeng.api.storage.data.IItemList; import appeng.client.gui.widgets.IScrollSource; import appeng.client.gui.widgets.ISortSource; import appeng.core.AEConfig; -import appeng.integration.modules.JEI; +import appeng.integration.Integrations; import appeng.items.storage.ItemViewCell; import appeng.util.ItemSorters; import appeng.util.Platform; @@ -58,7 +58,6 @@ public class ItemRepo private String searchString = ""; private IPartitionList myPartitionList; private String innerSearch = ""; - private String jeiSearch = null; private boolean hasPower; public ItemRepo( final IScrollSource src, final ISortSource sortSrc ) @@ -244,7 +243,7 @@ public class ItemRepo private void updateJEI( String filter ) { - JEI.instance.getJei().setSearchText( filter ); + Integrations.jei().setSearchText( filter ); } public int size() diff --git a/src/main/java/appeng/core/Registration.java b/src/main/java/appeng/core/Registration.java index abff1200..acd73d82 100644 --- a/src/main/java/appeng/core/Registration.java +++ b/src/main/java/appeng/core/Registration.java @@ -63,8 +63,7 @@ import appeng.core.localization.GuiText; import appeng.core.localization.PlayerMessages; import appeng.core.stats.PlayerStatsRegistration; import appeng.hooks.TickHandler; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; +import appeng.integration.Integrations; import appeng.items.materials.ItemMaterial; import appeng.items.parts.ItemFacade; import appeng.loot.ChestLoot; @@ -86,7 +85,6 @@ import appeng.recipes.game.ShapedRecipe; import appeng.recipes.game.ShapelessRecipe; import appeng.recipes.handlers.Crusher; import appeng.recipes.handlers.Grind; -import appeng.recipes.handlers.GrindFZ; import appeng.recipes.handlers.HCCrusher; import appeng.recipes.handlers.Inscribe; import appeng.recipes.handlers.Macerator; @@ -216,7 +214,6 @@ public final class Registration registry.addNewCraftHandler( "mekechamber", MekEnrichment.class ); registry.addNewCraftHandler( "grind", Grind.class ); registry.addNewCraftHandler( "crusher", Crusher.class ); - registry.addNewCraftHandler( "grindfz", GrindFZ.class ); registry.addNewCraftHandler( "pulverizer", Pulverizer.class ); registry.addNewCraftHandler( "macerator", Macerator.class ); @@ -248,7 +245,7 @@ public final class Registration final Runnable recipeLoader = new RecipeLoader( recipeDirectory, customRecipeConfig, this.recipeHandler ); 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.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" ); @@ -334,8 +331,6 @@ public final class Registration PlayerMessages.values(); GuiText.values(); - Api.INSTANCE.partHelper().initFMPSupport(); - definitions.getRegistry().getBootstrapComponents().forEach( b -> b.postInitialize( event.getSide() ) ); // Interface diff --git a/src/main/java/appeng/core/api/ApiPart.java b/src/main/java/appeng/core/api/ApiPart.java index 771e5eb1..8add84cd 100644 --- a/src/main/java/appeng/core/api/ApiPart.java +++ b/src/main/java/appeng/core/api/ApiPart.java @@ -56,9 +56,6 @@ import appeng.api.parts.IPartHelper; import appeng.api.parts.LayerBase; import appeng.core.AELog; import appeng.core.CommonHelper; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; -import appeng.integration.abstraction.IFMP; import appeng.parts.PartPlacement; import appeng.tile.AEBaseTile; import appeng.tile.networking.TileCableBus; @@ -79,17 +76,6 @@ public class ApiPart implements IPartHelper private final Map, String> interfaces2Layer = new HashMap<>(); private final List desc = new LinkedList(); - 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. *

diff --git a/src/main/java/appeng/core/sync/AppEngPacketHandlerBase.java b/src/main/java/appeng/core/sync/AppEngPacketHandlerBase.java index 4efd81fd..22a56193 100644 --- a/src/main/java/appeng/core/sync/AppEngPacketHandlerBase.java +++ b/src/main/java/appeng/core/sync/AppEngPacketHandlerBase.java @@ -38,7 +38,6 @@ import appeng.core.sync.packets.PacketLightning; import appeng.core.sync.packets.PacketMEInventoryUpdate; import appeng.core.sync.packets.PacketMatterCannon; import appeng.core.sync.packets.PacketMockExplosion; -import appeng.core.sync.packets.PacketMultiPart; import appeng.core.sync.packets.PacketJEIRecipe; import appeng.core.sync.packets.PacketNewStorageDimension; import appeng.core.sync.packets.PacketPaintedEntity; @@ -68,8 +67,6 @@ public class AppEngPacketHandlerBase PACKET_CONFIG_BUTTON( PacketConfigButton.class ), - PACKET_MULTIPART( PacketMultiPart.class ), - PACKET_PART_PLACEMENT( PacketPartPlacement.class ), PACKET_LIGHTNING( PacketLightning.class ), diff --git a/src/main/java/appeng/core/sync/packets/PacketMultiPart.java b/src/main/java/appeng/core/sync/packets/PacketMultiPart.java deleted file mode 100644 index ff74b42a..00000000 --- a/src/main/java/appeng/core/sync/packets/PacketMultiPart.java +++ /dev/null @@ -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 . - */ - -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. - } - } -} diff --git a/src/main/java/appeng/facade/FacadeContainer.java b/src/main/java/appeng/facade/FacadeContainer.java index cabc4587..8fffeafd 100644 --- a/src/main/java/appeng/facade/FacadeContainer.java +++ b/src/main/java/appeng/facade/FacadeContainer.java @@ -24,8 +24,6 @@ import java.util.Optional; 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.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -35,9 +33,6 @@ import appeng.api.parts.IFacadeContainer; import appeng.api.parts.IFacadePart; import appeng.api.parts.IPartHost; 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.parts.CableBusStorage; @@ -136,29 +131,16 @@ public class FacadeContainer implements IFacadeContainer { ids[0] = out.readInt(); ids[1] = out.readInt(); - final boolean isBC = ids[0] < 0; ids[0] = Math.abs( ids[0] ); - if( isBC && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) ) - { - final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport ); - final IBlockState state = Block.getStateById( ids[0] ); - final IFacadePart created = bc.createFacadePart( state, side ); - changed = changed || this.storage.getFacade( x ) == null; - - this.storage.setFacade( x, created ); - } - else if( !isBC ) - { - Optional 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 ) ); - } + Optional 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 ) ) ); } - 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 ) ) ); - } - } - } } } } diff --git a/src/main/java/appeng/integration/IIntegrationModule.java b/src/main/java/appeng/integration/IIntegrationModule.java index 64a7a8ae..6c478832 100644 --- a/src/main/java/appeng/integration/IIntegrationModule.java +++ b/src/main/java/appeng/integration/IIntegrationModule.java @@ -21,7 +21,26 @@ package appeng.integration; 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; + } + } } diff --git a/src/main/java/appeng/integration/IntegrationNode.java b/src/main/java/appeng/integration/IntegrationNode.java index 0ca3e3c3..aca23201 100644 --- a/src/main/java/appeng/integration/IntegrationNode.java +++ b/src/main/java/appeng/integration/IntegrationNode.java @@ -19,42 +19,38 @@ package appeng.integration; -import java.lang.reflect.Field; - import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModAPIManager; import appeng.api.exceptions.ModNotInstalled; import appeng.core.AEConfig; 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 modID; - private final IntegrationType shortName; + private final IntegrationType type; private IntegrationStage state = IntegrationStage.PRE_INIT; - private IntegrationStage failedStage = IntegrationStage.PRE_INIT; private Throwable exception = null; - private String name = null; - private Class classValue = null; - private Object instance; 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.shortName = shortName; + this.type = type; this.modID = modID; - this.name = name; } @Override public String toString() { - return this.getShortName().name() + ':' + this.getState().name(); + return this.getType().name() + ':' + this.getState().name(); } boolean isActive() @@ -98,10 +94,17 @@ public final class IntegrationNode if( enabled ) { - this.classValue = this.getClass().getClassLoader().loadClass( this.name ); - this.mod = (IIntegrationModule) this.classValue.getConstructor().newInstance(); - final Field f = this.classValue.getField( "instance" ); - f.set( this.classValue, this.setInstance( this.mod ) ); + switch (type) { + case IC2: + this.mod = Integrations.ic2 = new IC2Module(); + break; + case JEI: + this.mod = Integrations.jei = new JEIModule(); + break; + case Waila: + this.mod = new WailaModule(); + break; + } } else { @@ -128,7 +131,6 @@ public final class IntegrationNode } catch( final Throwable t ) { - this.failedStage = stage; this.exception = t; this.setState( IntegrationStage.FAILED ); } @@ -151,20 +153,9 @@ public final class IntegrationNode } } - Object getInstance() + IntegrationType getType() { - return this.instance; - } - - private Object setInstance( final Object instance ) - { - this.instance = instance; - return instance; - } - - IntegrationType getShortName() - { - return this.shortName; + return this.type; } IntegrationStage getState() diff --git a/src/main/java/appeng/integration/IntegrationRegistry.java b/src/main/java/appeng/integration/IntegrationRegistry.java index 12af6f34..0a2dcf54 100644 --- a/src/main/java/appeng/integration/IntegrationRegistry.java +++ b/src/main/java/appeng/integration/IntegrationRegistry.java @@ -22,8 +22,6 @@ package appeng.integration; import java.util.Collection; import java.util.LinkedList; -import javax.annotation.Nonnull; - import net.minecraftforge.fml.relauncher.FMLLaunchHandler; import net.minecraftforge.fml.relauncher.Side; @@ -32,8 +30,6 @@ public enum IntegrationRegistry { INSTANCE; - private static final String PACKAGE_PREFIX = "appeng.integration.modules."; - private final Collection modules = new LinkedList(); public void add( final IntegrationType type ) @@ -48,7 +44,7 @@ public enum IntegrationRegistry 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() @@ -83,7 +79,7 @@ public enum IntegrationRegistry 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 ); } @@ -94,7 +90,7 @@ public enum IntegrationRegistry { for( final IntegrationNode node : this.modules ) { - if( node.getShortName() == name ) + if( node.getType() == name ) { return node.isActive(); } @@ -102,18 +98,4 @@ public enum IntegrationRegistry 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." ); - } - } diff --git a/src/main/java/appeng/integration/IntegrationSide.java b/src/main/java/appeng/integration/IntegrationSide.java index 25fd40a4..0e4a4b33 100644 --- a/src/main/java/appeng/integration/IntegrationSide.java +++ b/src/main/java/appeng/integration/IntegrationSide.java @@ -19,7 +19,7 @@ package appeng.integration; -public enum IntegrationSide +enum IntegrationSide { CLIENT, SERVER, BOTH } diff --git a/src/main/java/appeng/integration/IntegrationStage.java b/src/main/java/appeng/integration/IntegrationStage.java index 628cf5d4..51035bcf 100644 --- a/src/main/java/appeng/integration/IntegrationStage.java +++ b/src/main/java/appeng/integration/IntegrationStage.java @@ -19,7 +19,7 @@ package appeng.integration; -public enum IntegrationStage +enum IntegrationStage { PRE_INIT, INIT, POST_INIT, diff --git a/src/main/java/appeng/integration/IntegrationType.java b/src/main/java/appeng/integration/IntegrationType.java index c800123a..b42ac45b 100644 --- a/src/main/java/appeng/integration/IntegrationType.java +++ b/src/main/java/appeng/integration/IntegrationType.java @@ -23,46 +23,22 @@ public enum IntegrationType { IC2( IntegrationSide.BOTH, "Industrial Craft 2", "IC2" ), - RotaryCraft( IntegrationSide.BOTH, "Rotary Craft", "RotaryCraft" ), - 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" ), RFItem( IntegrationSide.BOTH, "RedstoneFlux Power - Items", "CoFHAPI" ), 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" ), InvTweaks( IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks" ), JEI( IntegrationSide.CLIENT, "Just Enough Items", "JEI" ), - CraftGuide( IntegrationSide.CLIENT, "Craft Guide", "craftguide" ), - Mekanism( IntegrationSide.BOTH, "Mekanism", "Mekanism" ), - ImmibisMicroblocks( IntegrationSide.BOTH, "ImmibisMicroblocks", "ImmibisMicroblocks" ), - - BetterStorage( IntegrationSide.BOTH, "BetterStorage", "betterstorage" ), - OpenComputers( IntegrationSide.BOTH, "OpenComputers", "OpenComputers" ); public final IntegrationSide side; diff --git a/src/main/java/appeng/integration/Integrations.java b/src/main/java/appeng/integration/Integrations.java new file mode 100644 index 00000000..9aabeed5 --- /dev/null +++ b/src/main/java/appeng/integration/Integrations.java @@ -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; + } +} diff --git a/src/main/java/appeng/integration/abstraction/IBetterStorage.java b/src/main/java/appeng/integration/abstraction/IBetterStorage.java deleted file mode 100644 index eddf0c14..00000000 --- a/src/main/java/appeng/integration/abstraction/IBetterStorage.java +++ /dev/null @@ -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 . - */ - -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 ); -} diff --git a/src/main/java/appeng/integration/abstraction/IBuildCraftCore.java b/src/main/java/appeng/integration/abstraction/IBuildCraftCore.java deleted file mode 100644 index 3793661a..00000000 --- a/src/main/java/appeng/integration/abstraction/IBuildCraftCore.java +++ /dev/null @@ -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 . - */ - -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 ); -} diff --git a/src/main/java/appeng/integration/abstraction/IBuildCraftTransport.java b/src/main/java/appeng/integration/abstraction/IBuildCraftTransport.java deleted file mode 100644 index 09463574..00000000 --- a/src/main/java/appeng/integration/abstraction/IBuildCraftTransport.java +++ /dev/null @@ -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 . - */ - -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 ); -} diff --git a/src/main/java/appeng/integration/modules/ic2/IC2PowerSink.java b/src/main/java/appeng/integration/abstraction/IC2PowerSink.java similarity index 96% rename from src/main/java/appeng/integration/modules/ic2/IC2PowerSink.java rename to src/main/java/appeng/integration/abstraction/IC2PowerSink.java index 22e0cd2b..c3f7f7e5 100644 --- a/src/main/java/appeng/integration/modules/ic2/IC2PowerSink.java +++ b/src/main/java/appeng/integration/abstraction/IC2PowerSink.java @@ -16,7 +16,7 @@ * along with Applied Energistics 2. If not, see . */ -package appeng.integration.modules.ic2; +package appeng.integration.abstraction; import java.util.Set; diff --git a/src/main/java/appeng/integration/abstraction/ICLApi.java b/src/main/java/appeng/integration/abstraction/ICLApi.java deleted file mode 100644 index d3184ecc..00000000 --- a/src/main/java/appeng/integration/abstraction/ICLApi.java +++ /dev/null @@ -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 . - */ - -package appeng.integration.abstraction; - - -import appeng.api.util.AEColor; - - -public interface ICLApi -{ - - int colorLight( AEColor color, int light ); -} diff --git a/src/main/java/appeng/integration/abstraction/IDSU.java b/src/main/java/appeng/integration/abstraction/IDSU.java deleted file mode 100644 index 66899f09..00000000 --- a/src/main/java/appeng/integration/abstraction/IDSU.java +++ /dev/null @@ -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 . - */ - -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 ); -} diff --git a/src/main/java/appeng/integration/abstraction/IFMP.java b/src/main/java/appeng/integration/abstraction/IFMP.java deleted file mode 100644 index 143c9d85..00000000 --- a/src/main/java/appeng/integration/abstraction/IFMP.java +++ /dev/null @@ -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 . - */ - -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 ); -} diff --git a/src/main/java/appeng/integration/abstraction/IFZ.java b/src/main/java/appeng/integration/abstraction/IFZ.java deleted file mode 100644 index 372b5208..00000000 --- a/src/main/java/appeng/integration/abstraction/IFZ.java +++ /dev/null @@ -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 . - */ - -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 ); -} diff --git a/src/main/java/appeng/integration/abstraction/IForestry.java b/src/main/java/appeng/integration/abstraction/IForestry.java deleted file mode 100644 index 816583c0..00000000 --- a/src/main/java/appeng/integration/abstraction/IForestry.java +++ /dev/null @@ -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 . - */ - -package appeng.integration.abstraction; - - -import appeng.api.features.IItemComparisonProvider; - - -public interface IForestry -{ - - IItemComparisonProvider getGeneticsComparisonProvider(); -} \ No newline at end of file diff --git a/src/main/java/appeng/integration/abstraction/IGT.java b/src/main/java/appeng/integration/abstraction/IGT.java deleted file mode 100644 index 959f9dfc..00000000 --- a/src/main/java/appeng/integration/abstraction/IGT.java +++ /dev/null @@ -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 . - */ - -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 ); -} diff --git a/src/main/java/appeng/integration/abstraction/IIC2.java b/src/main/java/appeng/integration/abstraction/IIC2.java index 9bcc376a..21b307bf 100644 --- a/src/main/java/appeng/integration/abstraction/IIC2.java +++ b/src/main/java/appeng/integration/abstraction/IIC2.java @@ -20,11 +20,29 @@ package appeng.integration.abstraction; 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 + { + + } } diff --git a/src/main/java/appeng/integration/abstraction/IImmibisMicroblocks.java b/src/main/java/appeng/integration/abstraction/IImmibisMicroblocks.java deleted file mode 100644 index 5d79e67b..00000000 --- a/src/main/java/appeng/integration/abstraction/IImmibisMicroblocks.java +++ /dev/null @@ -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 . - */ - -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 ); -} diff --git a/src/main/java/appeng/integration/abstraction/IInvTweaks.java b/src/main/java/appeng/integration/abstraction/IInvTweaks.java index e493123f..f24d5c74 100644 --- a/src/main/java/appeng/integration/abstraction/IInvTweaks.java +++ b/src/main/java/appeng/integration/abstraction/IInvTweaks.java @@ -21,9 +21,19 @@ package appeng.integration.abstraction; 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 + { + } + } diff --git a/src/main/java/appeng/integration/abstraction/IJEI.java b/src/main/java/appeng/integration/abstraction/IJEI.java index 2fefc556..24c31ae3 100644 --- a/src/main/java/appeng/integration/abstraction/IJEI.java +++ b/src/main/java/appeng/integration/abstraction/IJEI.java @@ -1,15 +1,25 @@ package appeng.integration.abstraction; +import appeng.integration.IIntegrationModule; + + /** * 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 + { + } } diff --git a/src/main/java/appeng/integration/abstraction/ILP.java b/src/main/java/appeng/integration/abstraction/ILP.java deleted file mode 100644 index f1133494..00000000 --- a/src/main/java/appeng/integration/abstraction/ILP.java +++ /dev/null @@ -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 . - */ - -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 getCraftedItems( TileEntity te ); - - List getProvidedItems( TileEntity te ); - - boolean isRequestPipe( TileEntity te ); - - List performRequest( TileEntity te, ItemStack wanted ); - - IMEInventory getInv( TileEntity te ); - - Object getGetPowerPipe( TileEntity te ); - - boolean isPowerSource( TileEntity tt ); - - boolean canUseEnergy( Object pp, int ceil, List providersToIgnore ); - - boolean useEnergy( Object pp, int ceil, List providersToIgnore ); -} diff --git a/src/main/java/appeng/integration/abstraction/IMekanism.java b/src/main/java/appeng/integration/abstraction/IMekanism.java index 8f56d415..cc1b48dd 100644 --- a/src/main/java/appeng/integration/abstraction/IMekanism.java +++ b/src/main/java/appeng/integration/abstraction/IMekanism.java @@ -21,11 +21,21 @@ package appeng.integration.abstraction; 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 + { + } } diff --git a/src/main/java/appeng/integration/abstraction/IRC.java b/src/main/java/appeng/integration/abstraction/IRC.java index 857a5cc0..3353650f 100644 --- a/src/main/java/appeng/integration/abstraction/IRC.java +++ b/src/main/java/appeng/integration/abstraction/IRC.java @@ -21,9 +21,16 @@ package appeng.integration.abstraction; 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 { + } + } diff --git a/src/main/java/appeng/integration/abstraction/ITE.java b/src/main/java/appeng/integration/abstraction/ITE.java deleted file mode 100644 index 45a71915..00000000 --- a/src/main/java/appeng/integration/abstraction/ITE.java +++ /dev/null @@ -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 . - */ - -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 ); -} diff --git a/src/main/java/appeng/integration/modules/JEI.java b/src/main/java/appeng/integration/modules/JEI.java deleted file mode 100644 index 4597d347..00000000 --- a/src/main/java/appeng/integration/modules/JEI.java +++ /dev/null @@ -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; - } - -} diff --git a/src/main/java/appeng/integration/modules/IC2.java b/src/main/java/appeng/integration/modules/ic2/IC2Module.java similarity index 76% rename from src/main/java/appeng/integration/modules/IC2.java rename to src/main/java/appeng/integration/modules/ic2/IC2Module.java index eef63d00..5b756475 100644 --- a/src/main/java/appeng/integration/modules/IC2.java +++ b/src/main/java/appeng/integration/modules/ic2/IC2Module.java @@ -16,11 +16,9 @@ * along with Applied Energistics 2. If not, see . */ -package appeng.integration.modules; +package appeng.integration.modules.ic2; -import java.util.function.BiFunction; - import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -29,36 +27,21 @@ import ic2.api.recipe.RecipeInputItemStack; import appeng.api.AEApi; import appeng.api.config.TunnelType; import appeng.api.features.IP2PTunnelRegistry; -import appeng.helpers.Reflected; -import appeng.integration.IIntegrationModule; import appeng.integration.IntegrationHelper; +import appeng.integration.abstraction.IC2PowerSink; 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; -public class IC2 implements IIntegrationModule, IIC2 +public class IC2Module implements IIC2 { - @Reflected - public static IC2 instance; - - public IC2() + public IC2Module() { IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class ); IntegrationHelper.testClassExistence( this, ic2.api.recipe.RecipeInputItemStack.class ); } - private static BiFunction powerSinkFactory = ( ( te, sink ) -> IC2PowerSinkStub.INSTANCE ); - - @Override - public void init() throws Throwable - { - powerSinkFactory = IC2PowerSinkAdapter::new; - } - @Override public void postInit() { @@ -76,7 +59,7 @@ public class IC2 implements IIntegrationModule, IIC2 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 ); } @@ -84,9 +67,10 @@ public class IC2 implements IIntegrationModule, IIC2 /** * 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 @@ -94,5 +78,4 @@ public class IC2 implements IIntegrationModule, IIC2 { ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, false, out ); } - } diff --git a/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkAdapter.java b/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkAdapter.java index 2f22b369..ec4dc0d1 100644 --- a/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkAdapter.java +++ b/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkAdapter.java @@ -29,6 +29,7 @@ import ic2.api.energy.prefab.BasicSink; import ic2.api.energy.tile.IEnergyEmitter; import appeng.api.config.PowerUnits; +import appeng.integration.abstraction.IC2PowerSink; import appeng.tile.powersink.IExternalPowerSink; diff --git a/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkStub.java b/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkStub.java index ddfc4637..a7765440 100644 --- a/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkStub.java +++ b/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkStub.java @@ -19,6 +19,9 @@ package appeng.integration.modules.ic2; +import appeng.integration.abstraction.IC2PowerSink; + + /** * Implementation of IC2PowerSink that just stubs out all methods and does nothing. */ diff --git a/src/main/java/appeng/integration/modules/jei/NullJEI.java b/src/main/java/appeng/integration/modules/jei/JEIModule.java similarity index 52% rename from src/main/java/appeng/integration/modules/jei/NullJEI.java rename to src/main/java/appeng/integration/modules/jei/JEIModule.java index ee44c7a8..ac0a216c 100644 --- a/src/main/java/appeng/integration/modules/jei/NullJEI.java +++ b/src/main/java/appeng/integration/modules/jei/JEIModule.java @@ -4,22 +4,37 @@ package appeng.integration.modules.jei; 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 public boolean isEnabled() { return false; } - @Override - public String getSearchText() - { - return ""; - } - - @Override - public void setSearchText( String searchText ) - { - } } diff --git a/src/main/java/appeng/integration/modules/jei/JEIPlugin.java b/src/main/java/appeng/integration/modules/jei/JEIPlugin.java index 82678da9..fa6556da 100644 --- a/src/main/java/appeng/integration/modules/jei/JEIPlugin.java +++ b/src/main/java/appeng/integration/modules/jei/JEIPlugin.java @@ -26,9 +26,7 @@ import appeng.container.implementations.ContainerPatternTerm; import appeng.core.AEConfig; import appeng.core.features.AEFeature; import appeng.core.localization.GuiText; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; -import appeng.integration.modules.JEI; +import appeng.integration.Integrations; import appeng.items.parts.ItemFacade; @@ -180,7 +178,7 @@ public class JEIPlugin extends BlankModPlugin @Override public void onRuntimeAvailable( IJeiRuntime jeiRuntime ) { - JEI jeiModule = (JEI) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.JEI ); + JEIModule jeiModule = (JEIModule) Integrations.jei(); jeiModule.setJei( new JeiRuntimeAdapter( jeiRuntime ) ); } } diff --git a/src/main/java/appeng/integration/modules/Waila.java b/src/main/java/appeng/integration/modules/waila/WailaModule.java similarity index 86% rename from src/main/java/appeng/integration/modules/Waila.java rename to src/main/java/appeng/integration/modules/waila/WailaModule.java index 866f4dd3..75241496 100644 --- a/src/main/java/appeng/integration/modules/Waila.java +++ b/src/main/java/appeng/integration/modules/waila/WailaModule.java @@ -16,7 +16,7 @@ * along with Applied Energistics 2. If not, see . */ -package appeng.integration.modules; +package appeng.integration.modules.waila; 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.IWailaRegistrar; -import appeng.helpers.Reflected; import appeng.integration.IIntegrationModule; import appeng.integration.IntegrationHelper; -import appeng.integration.modules.waila.PartWailaDataProvider; -import appeng.integration.modules.waila.TileWailaDataProvider; import appeng.tile.AEBaseTile; -public class Waila implements IIntegrationModule +public class WailaModule implements IIntegrationModule { - @Reflected - public static Waila instance; - @Reflected - public Waila() + public WailaModule() { IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataProvider.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" ); } - @Override - public void postInit() - { - } } diff --git a/src/main/java/appeng/parts/CableBusContainer.java b/src/main/java/appeng/parts/CableBusContainer.java index e30bcc5d..5d82a290 100644 --- a/src/main/java/appeng/parts/CableBusContainer.java +++ b/src/main/java/appeng/parts/CableBusContainer.java @@ -70,9 +70,6 @@ import appeng.client.render.cablebus.FacadeRenderState; import appeng.core.AELog; import appeng.facade.FacadeContainer; import appeng.helpers.AEMultiTile; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; -import appeng.integration.abstraction.ICLApi; import appeng.me.GridConnection; import appeng.parts.networking.PartCable; 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; } diff --git a/src/main/java/appeng/parts/PartPlacement.java b/src/main/java/appeng/parts/PartPlacement.java index 7ae9c371..f93bbc1b 100644 --- a/src/main/java/appeng/parts/PartPlacement.java +++ b/src/main/java/appeng/parts/PartPlacement.java @@ -60,10 +60,6 @@ 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.IntegrationRegistry; -import appeng.integration.IntegrationType; -import appeng.integration.abstraction.IBuildCraftTransport; -import appeng.integration.abstraction.IFMP; import appeng.util.LookDirection; 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 ) { final Block block = world.getBlockState( pos ).getBlock(); @@ -271,23 +251,6 @@ public class PartPlacement 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 maybeMultiPartStack = multiPart.maybeStack( 1 ); final Optional maybeMultiPartBlock = multiPart.maybeBlock(); final Optional maybeMultiPartItemBlock = multiPart.maybeItemBlock(); @@ -336,11 +299,6 @@ public class PartPlacement final Block blkID = world.getBlockState( te_pos ).getBlock(); 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 != // AEPartLocation.INTERNAL // ) @@ -429,15 +387,6 @@ public class PartPlacement 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; } diff --git a/src/main/java/appeng/parts/p2p/PartP2PItems.java b/src/main/java/appeng/parts/p2p/PartP2PItems.java index 22931993..ccf37fa3 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PItems.java +++ b/src/main/java/appeng/parts/p2p/PartP2PItems.java @@ -41,15 +41,11 @@ import appeng.api.networking.ticking.IGridTickable; import appeng.api.networking.ticking.TickRateModulation; import appeng.api.networking.ticking.TickingRequest; 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.me.GridAccessException; import appeng.me.cache.helpers.TunnelCollection; import appeng.tile.inventory.AppEngNullInventory; import appeng.util.Platform; -import appeng.util.inv.WrapperBCPipe; import appeng.util.inv.WrapperChainedInventory; import appeng.util.inv.WrapperMCISidedInventory; @@ -143,27 +139,6 @@ public class PartP2PItems extends PartP2PTunnel implements /* IPip 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( te instanceof TileEntityChest ) diff --git a/src/main/java/appeng/recipes/handlers/Crusher.java b/src/main/java/appeng/recipes/handlers/Crusher.java index 5754012a..67ee4412 100644 --- a/src/main/java/appeng/recipes/handlers/Crusher.java +++ b/src/main/java/appeng/recipes/handlers/Crusher.java @@ -29,8 +29,7 @@ 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.Integrations; import appeng.integration.abstraction.IRC; import appeng.recipes.RecipeHandler; import appeng.util.Platform; @@ -61,19 +60,16 @@ public class Crusher implements ICraftHandler, IWebsiteSerializer @Override 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 ); - for( final ItemStack is : this.pro_input.getItemStackSet() ) + try { - try - { - rc.rockCrusher( is, this.pro_output[0].getItemStack() ); - } - catch( final java.lang.RuntimeException err ) - { - AELog.info( "RC not happy - " + err.getMessage() ); - } + rc.rockCrusher( is, this.pro_output[0].getItemStack() ); + } + catch( final java.lang.RuntimeException err ) + { + AELog.info( "RC not happy - " + err.getMessage() ); } } } diff --git a/src/main/java/appeng/recipes/handlers/GrindFZ.java b/src/main/java/appeng/recipes/handlers/GrindFZ.java deleted file mode 100644 index ac5e43e2..00000000 --- a/src/main/java/appeng/recipes/handlers/GrindFZ.java +++ /dev/null @@ -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 . - */ - -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> input, final List> 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 ); - } -} diff --git a/src/main/java/appeng/recipes/handlers/Macerator.java b/src/main/java/appeng/recipes/handlers/Macerator.java index 8dea1c93..d1087f11 100644 --- a/src/main/java/appeng/recipes/handlers/Macerator.java +++ b/src/main/java/appeng/recipes/handlers/Macerator.java @@ -29,8 +29,7 @@ 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.Integrations; import appeng.integration.abstraction.IIC2; import appeng.recipes.RecipeHandler; import appeng.util.Platform; @@ -61,19 +60,16 @@ public class Macerator implements ICraftHandler, IWebsiteSerializer @Override 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 ); - for( final ItemStack is : this.pro_input.getItemStackSet() ) + try { - try - { - ic2.maceratorRecipe( is, this.pro_output[0].getItemStack() ); - } - catch( final java.lang.RuntimeException err ) - { - AELog.info( "IC2 not happy - " + err.getMessage() ); - } + ic2.maceratorRecipe( is, this.pro_output[0].getItemStack() ); + } + catch( final java.lang.RuntimeException err ) + { + AELog.info( "IC2 not happy - " + err.getMessage() ); } } } diff --git a/src/main/java/appeng/recipes/handlers/MekCrusher.java b/src/main/java/appeng/recipes/handlers/MekCrusher.java index 371ecc07..af9ce918 100644 --- a/src/main/java/appeng/recipes/handlers/MekCrusher.java +++ b/src/main/java/appeng/recipes/handlers/MekCrusher.java @@ -29,8 +29,7 @@ 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.Integrations; import appeng.integration.abstraction.IMekanism; import appeng.recipes.RecipeHandler; import appeng.util.Platform; @@ -62,19 +61,16 @@ public class MekCrusher implements ICraftHandler, IWebsiteSerializer @Override 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 ); - for( final ItemStack is : this.pro_input.getItemStackSet() ) + try { - try - { - rc.addCrusherRecipe( is, this.pro_output[0].getItemStack() ); - } - catch( final java.lang.RuntimeException err ) - { - AELog.info( "Mekanism not happy - " + err.getMessage() ); - } + mekanism.addCrusherRecipe( is, this.pro_output[0].getItemStack() ); + } + catch( final java.lang.RuntimeException err ) + { + AELog.info( "Mekanism not happy - " + err.getMessage() ); } } } diff --git a/src/main/java/appeng/recipes/handlers/MekEnrichment.java b/src/main/java/appeng/recipes/handlers/MekEnrichment.java index e5037725..7d2c8e0b 100644 --- a/src/main/java/appeng/recipes/handlers/MekEnrichment.java +++ b/src/main/java/appeng/recipes/handlers/MekEnrichment.java @@ -29,8 +29,7 @@ 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.Integrations; import appeng.integration.abstraction.IMekanism; import appeng.recipes.RecipeHandler; import appeng.util.Platform; @@ -61,19 +60,16 @@ public class MekEnrichment implements ICraftHandler, IWebsiteSerializer @Override 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 ); - for( final ItemStack is : this.pro_input.getItemStackSet() ) + try { - try - { - rc.addEnrichmentChamberRecipe( is, this.pro_output[0].getItemStack() ); - } - catch( final java.lang.RuntimeException err ) - { - AELog.info( "Mekanism not happy - " + err.getMessage() ); - } + mekanism.addEnrichmentChamberRecipe( is, this.pro_output[0].getItemStack() ); + } + catch( final java.lang.RuntimeException err ) + { + AELog.info( "Mekanism not happy - " + err.getMessage() ); } } } diff --git a/src/main/java/appeng/tile/misc/TileInterface.java b/src/main/java/appeng/tile/misc/TileInterface.java index 3ec12854..ca3f1e0d 100644 --- a/src/main/java/appeng/tile/misc/TileInterface.java +++ b/src/main/java/appeng/tile/misc/TileInterface.java @@ -47,13 +47,9 @@ import appeng.api.networking.crafting.ICraftingProviderHelper; import appeng.api.networking.events.MENetworkChannelsChanged; import appeng.api.networking.events.MENetworkEventSubscribe; import appeng.api.networking.events.MENetworkPowerStatusChange; -import appeng.api.networking.security.BaseActionSource; import appeng.api.networking.ticking.IGridTickable; import appeng.api.networking.ticking.TickRateModulation; 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.util.AECableType; import appeng.api.util.AEPartLocation; diff --git a/src/main/java/appeng/tile/networking/TileCableBus.java b/src/main/java/appeng/tile/networking/TileCableBus.java index a90bfc2b..f10a38ee 100644 --- a/src/main/java/appeng/tile/networking/TileCableBus.java +++ b/src/main/java/appeng/tile/networking/TileCableBus.java @@ -51,9 +51,6 @@ import appeng.block.networking.BlockCableBus; import appeng.helpers.AEMultiTile; import appeng.helpers.ICustomCollision; import appeng.hooks.TickHandler; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; -import appeng.integration.abstraction.IImmibisMicroblocks; import appeng.parts.CableBusContainer; import appeng.tile.AEBaseTile; import appeng.tile.TileEvent; @@ -341,15 +338,6 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl @Override 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 ); } diff --git a/src/main/java/appeng/tile/powersink/AERootPoweredTile.java b/src/main/java/appeng/tile/powersink/AERootPoweredTile.java index 21a02e56..867279e6 100644 --- a/src/main/java/appeng/tile/powersink/AERootPoweredTile.java +++ b/src/main/java/appeng/tile/powersink/AERootPoweredTile.java @@ -35,8 +35,8 @@ import appeng.api.config.PowerUnits; import appeng.api.networking.energy.IAEPowerStorage; import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType; import appeng.capabilities.Capabilities; -import appeng.integration.modules.IC2; -import appeng.integration.modules.ic2.IC2PowerSink; +import appeng.integration.Integrations; +import appeng.integration.abstraction.IC2PowerSink; import appeng.tile.AEBaseInvTile; import appeng.tile.TileEvent; import appeng.tile.events.TileEventType; @@ -65,7 +65,7 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe { teslaEnergyAdapter = new TeslaEnergyAdapter( this ); } - ic2Sink = IC2.createPowerSink( this, this ); + ic2Sink = Integrations.ic2().createPowerSink( this, this ); ic2Sink.setValidFaces( internalPowerSides ); } diff --git a/src/main/java/appeng/util/InventoryAdaptor.java b/src/main/java/appeng/util/InventoryAdaptor.java index 8c9a6939..a137bc49 100644 --- a/src/main/java/appeng/util/InventoryAdaptor.java +++ b/src/main/java/appeng/util/InventoryAdaptor.java @@ -32,9 +32,6 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; 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.AdaptorItemHandler; import appeng.util.inv.AdaptorList; @@ -71,8 +68,6 @@ public abstract class InventoryAdaptor implements Iterable } } - final IBetterStorage bs = (IBetterStorage) ( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BetterStorage ) ? IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BetterStorage ) : null ); - if( te instanceof EntityPlayer ) { return new AdaptorIInventory( new AdaptorPlayerInventory( ( (EntityPlayer) te ).inventory, false ) ); @@ -84,10 +79,6 @@ public abstract class InventoryAdaptor implements Iterable return new AdaptorList( list ); } - else if( bs != null && bs.isStorageCrate( te ) ) - { - return bs.getAdaptor( te, d ); - } else if( te instanceof TileEntityChest ) { return new AdaptorIInventory( Platform.GetChestInv( te ) ); diff --git a/src/main/java/appeng/util/ItemSorters.java b/src/main/java/appeng/util/ItemSorters.java index 3106f299..fbfc0557 100644 --- a/src/main/java/appeng/util/ItemSorters.java +++ b/src/main/java/appeng/util/ItemSorters.java @@ -23,8 +23,7 @@ import java.util.Comparator; import appeng.api.config.SortDir; import appeng.api.storage.data.IAEItemStack; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; +import appeng.integration.Integrations; import appeng.integration.abstraction.IInvTweaks; import appeng.util.item.AEItemStack; @@ -111,9 +110,9 @@ public class ItemSorters return; } - if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.InvTweaks ) ) + if( Integrations.invTweaks().isEnabled() ) { - api = (IInvTweaks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.InvTweaks ); + api = Integrations.invTweaks(); } else { diff --git a/src/main/java/appeng/util/Platform.java b/src/main/java/appeng/util/Platform.java index 9c84c86d..9568de21 100644 --- a/src/main/java/appeng/util/Platform.java +++ b/src/main/java/appeng/util/Platform.java @@ -30,7 +30,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Random; import java.util.WeakHashMap; - import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -126,8 +125,7 @@ import appeng.core.stats.Stats; import appeng.core.sync.GuiBridge; import appeng.core.sync.GuiHostType; import appeng.hooks.TickHandler; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; +import appeng.integration.Integrations; import appeng.me.GridAccessException; import appeng.me.GridNode; import appeng.me.helpers.AENetworkProxy; @@ -344,17 +342,17 @@ public class Platform 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; } - if( e == SearchBoxMode.JEI_AUTOSEARCH && !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.JEI ) ) + if( e == SearchBoxMode.JEI_AUTOSEARCH && !Integrations.jei().isEnabled() ) { return true; } - if( e == SearchBoxMode.JEI_MANUAL_SEARCH && !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.JEI ) ) + if( e == SearchBoxMode.JEI_MANUAL_SEARCH && !Integrations.jei().isEnabled() ) { return true; } diff --git a/src/main/java/appeng/util/inv/WrapperBCPipe.java b/src/main/java/appeng/util/inv/WrapperBCPipe.java deleted file mode 100644 index ca611532..00000000 --- a/src/main/java/appeng/util/inv/WrapperBCPipe.java +++ /dev/null @@ -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 . - */ - -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; - } -}