From 61acdc7d3e77d9d3375078acd311fd1968a61b2e Mon Sep 17 00:00:00 2001 From: Progwml6 Date: Wed, 2 Oct 2013 00:39:00 -0400 Subject: [PATCH] add most of AE api, uncomment code for AE charging --- src/appeng/api/Blocks.java | 67 +++++ src/appeng/api/DimentionalCoord.java | 58 +++++ src/appeng/api/IAEItemStack.java | 175 +++++++++++++ src/appeng/api/IAETagCompound.java | 33 +++ src/appeng/api/IAppEngApi.java | 161 ++++++++++++ src/appeng/api/IAppEngGrinderRecipe.java | 45 ++++ src/appeng/api/ICellHandler.java | 25 ++ src/appeng/api/ICellRegistry.java | 31 +++ src/appeng/api/IExternalStorageHandler.java | 27 ++ src/appeng/api/IExternalStorageRegistry.java | 22 ++ src/appeng/api/IGridCacheRegistry.java | 24 ++ src/appeng/api/IGrinderRecipeManager.java | 32 +++ src/appeng/api/IItemComparisionProvider.java | 25 ++ src/appeng/api/IItemComparison.java | 10 + src/appeng/api/IItemList.java | 32 +++ src/appeng/api/ILocateableRegistry.java | 15 ++ .../api/ISpecialComparisonRegistry.java | 24 ++ src/appeng/api/IWirelessTermHandler.java | 49 ++++ src/appeng/api/IWirelessTermRegistery.java | 38 +++ src/appeng/api/Items.java | 36 +++ src/appeng/api/Materials.java | 58 +++++ src/appeng/api/README.txt | 46 ++++ src/appeng/api/TileRef.java | 60 +++++ src/appeng/api/Util.java | 230 ++++++++++++++++++ src/appeng/api/WorldCoord.java | 132 ++++++++++ src/appeng/api/config/ActionItems.java | 17 ++ src/appeng/api/config/CondenserOuput.java | 19 ++ src/appeng/api/config/EnableDisable.java | 18 ++ src/appeng/api/config/FullnessMode.java | 19 ++ src/appeng/api/config/FuzzyMode.java | 27 ++ src/appeng/api/config/IConfigEnum.java | 11 + .../api/config/InterfaceBlockingMode.java | 17 ++ .../api/config/InterfaceCraftingMode.java | 17 ++ src/appeng/api/config/ItemFlow.java | 18 ++ src/appeng/api/config/ListMode.java | 18 ++ src/appeng/api/config/MatchingMode.java | 17 ++ src/appeng/api/config/OperationMode.java | 18 ++ src/appeng/api/config/PowerUnits.java | 19 ++ src/appeng/api/config/RedstoneModeInput.java | 20 ++ .../api/config/RedstoneModeInputOnOff.java | 19 ++ src/appeng/api/config/RedstoneModeOutput.java | 18 ++ src/appeng/api/config/SearchBoxMode.java | 22 ++ src/appeng/api/config/SortDir.java | 18 ++ src/appeng/api/config/SortOrder.java | 20 ++ src/appeng/api/config/StackModeInput.java | 18 ++ src/appeng/api/config/StackModeOutput.java | 20 ++ src/appeng/api/config/TransferDir.java | 18 ++ src/appeng/api/config/ViewItems.java | 19 ++ src/appeng/api/events/AEWorldEvent.java | 17 ++ src/appeng/api/events/GridErrorEvent.java | 18 ++ .../api/events/GridPatternUpdateEvent.java | 22 ++ .../api/events/GridStorageUpdateEvent.java | 22 ++ .../api/events/GridTileConnectivityEvent.java | 22 ++ src/appeng/api/events/GridTileLoadEvent.java | 22 ++ .../api/events/GridTileUnloadEvent.java | 22 ++ .../api/events/LocateableEventAnnounce.java | 25 ++ .../api/events/MultiBlockUpdateEvent.java | 22 ++ .../api/exceptions/AppEngException.java | 12 + .../AppEngTileMissingException.java | 30 +++ .../api/me/items/IAEChargeableItem.java | 25 ++ src/appeng/api/me/items/IAEWrench.java | 9 + .../api/me/items/IAssemblerPatternItem.java | 8 + .../api/me/items/ILocationPatternItem.java | 7 + src/appeng/api/me/items/IMEPatternItem.java | 9 + src/appeng/api/me/items/IMemoryCard.java | 40 +++ src/appeng/api/me/items/IStorageCell.java | 48 ++++ .../api/me/items/IStorageComponent.java | 21 ++ src/appeng/api/me/tiles/IAssemblerMB.java | 20 ++ .../me/tiles/IAssemblerPatternProvider.java | 11 + src/appeng/api/me/tiles/ICellContainer.java | 24 ++ src/appeng/api/me/tiles/ICellProvider.java | 23 ++ src/appeng/api/me/tiles/IColoredMETile.java | 36 +++ .../api/me/tiles/IConfigureableTile.java | 28 +++ .../api/me/tiles/IConnectionSensitive.java | 11 + .../api/me/tiles/IDirectionalMETile.java | 20 ++ .../api/me/tiles/IExtendedCellProvider.java | 13 + .../api/me/tiles/IFulllyOptionalMETile.java | 11 + src/appeng/api/me/tiles/IGridMachine.java | 13 + src/appeng/api/me/tiles/IGridTeleport.java | 11 + src/appeng/api/me/tiles/IGridTileEntity.java | 49 ++++ src/appeng/api/me/tiles/ILocateable.java | 10 + src/appeng/api/me/tiles/IMEPowerStorage.java | 34 +++ src/appeng/api/me/tiles/INonSignalBlock.java | 9 + src/appeng/api/me/tiles/IOptionalMETile.java | 14 ++ src/appeng/api/me/tiles/IOrientableTile.java | 26 ++ src/appeng/api/me/tiles/IPriorityTile.java | 17 ++ src/appeng/api/me/tiles/IPushable.java | 30 +++ src/appeng/api/me/tiles/IStorageAware.java | 13 + src/appeng/api/me/tiles/IStorageMonitor.java | 20 ++ src/appeng/api/me/tiles/ITileCable.java | 7 + src/appeng/api/me/tiles/ITileIOCable.java | 30 +++ .../api/me/tiles/ITileInterfaceApi.java | 78 ++++++ .../me/tiles/InterfaceCraftingPattern.java | 19 ++ src/appeng/api/me/util/Grid.java | 84 +++++++ src/appeng/api/me/util/IAssemblerCluster.java | 37 +++ src/appeng/api/me/util/IAssemblerPattern.java | 78 ++++++ src/appeng/api/me/util/IConfigManager.java | 10 + src/appeng/api/me/util/ICraftRequest.java | 9 + src/appeng/api/me/util/ICraftWatcher.java | 12 + src/appeng/api/me/util/IGridCache.java | 46 ++++ src/appeng/api/me/util/IGridInterface.java | 219 +++++++++++++++++ src/appeng/api/me/util/ILocationPattern.java | 12 + src/appeng/api/me/util/IMEInventory.java | 77 ++++++ .../api/me/util/IMEInventoryHandler.java | 76 ++++++ src/appeng/api/me/util/IMEInventoryUtil.java | 19 ++ .../me/util/InterfaceCraftingResponse.java | 13 + src/tconstruct/library/tools/ToolCore.java | 13 +- 107 files changed, 3560 insertions(+), 5 deletions(-) create mode 100644 src/appeng/api/Blocks.java create mode 100644 src/appeng/api/DimentionalCoord.java create mode 100644 src/appeng/api/IAEItemStack.java create mode 100644 src/appeng/api/IAETagCompound.java create mode 100644 src/appeng/api/IAppEngApi.java create mode 100644 src/appeng/api/IAppEngGrinderRecipe.java create mode 100644 src/appeng/api/ICellHandler.java create mode 100644 src/appeng/api/ICellRegistry.java create mode 100644 src/appeng/api/IExternalStorageHandler.java create mode 100644 src/appeng/api/IExternalStorageRegistry.java create mode 100644 src/appeng/api/IGridCacheRegistry.java create mode 100644 src/appeng/api/IGrinderRecipeManager.java create mode 100644 src/appeng/api/IItemComparisionProvider.java create mode 100644 src/appeng/api/IItemComparison.java create mode 100644 src/appeng/api/IItemList.java create mode 100644 src/appeng/api/ILocateableRegistry.java create mode 100644 src/appeng/api/ISpecialComparisonRegistry.java create mode 100644 src/appeng/api/IWirelessTermHandler.java create mode 100644 src/appeng/api/IWirelessTermRegistery.java create mode 100644 src/appeng/api/Items.java create mode 100644 src/appeng/api/Materials.java create mode 100644 src/appeng/api/README.txt create mode 100644 src/appeng/api/TileRef.java create mode 100644 src/appeng/api/Util.java create mode 100644 src/appeng/api/WorldCoord.java create mode 100644 src/appeng/api/config/ActionItems.java create mode 100644 src/appeng/api/config/CondenserOuput.java create mode 100644 src/appeng/api/config/EnableDisable.java create mode 100644 src/appeng/api/config/FullnessMode.java create mode 100644 src/appeng/api/config/FuzzyMode.java create mode 100644 src/appeng/api/config/IConfigEnum.java create mode 100644 src/appeng/api/config/InterfaceBlockingMode.java create mode 100644 src/appeng/api/config/InterfaceCraftingMode.java create mode 100644 src/appeng/api/config/ItemFlow.java create mode 100644 src/appeng/api/config/ListMode.java create mode 100644 src/appeng/api/config/MatchingMode.java create mode 100644 src/appeng/api/config/OperationMode.java create mode 100644 src/appeng/api/config/PowerUnits.java create mode 100644 src/appeng/api/config/RedstoneModeInput.java create mode 100644 src/appeng/api/config/RedstoneModeInputOnOff.java create mode 100644 src/appeng/api/config/RedstoneModeOutput.java create mode 100644 src/appeng/api/config/SearchBoxMode.java create mode 100644 src/appeng/api/config/SortDir.java create mode 100644 src/appeng/api/config/SortOrder.java create mode 100644 src/appeng/api/config/StackModeInput.java create mode 100644 src/appeng/api/config/StackModeOutput.java create mode 100644 src/appeng/api/config/TransferDir.java create mode 100644 src/appeng/api/config/ViewItems.java create mode 100644 src/appeng/api/events/AEWorldEvent.java create mode 100644 src/appeng/api/events/GridErrorEvent.java create mode 100644 src/appeng/api/events/GridPatternUpdateEvent.java create mode 100644 src/appeng/api/events/GridStorageUpdateEvent.java create mode 100644 src/appeng/api/events/GridTileConnectivityEvent.java create mode 100644 src/appeng/api/events/GridTileLoadEvent.java create mode 100644 src/appeng/api/events/GridTileUnloadEvent.java create mode 100644 src/appeng/api/events/LocateableEventAnnounce.java create mode 100644 src/appeng/api/events/MultiBlockUpdateEvent.java create mode 100644 src/appeng/api/exceptions/AppEngException.java create mode 100644 src/appeng/api/exceptions/AppEngTileMissingException.java create mode 100644 src/appeng/api/me/items/IAEChargeableItem.java create mode 100644 src/appeng/api/me/items/IAEWrench.java create mode 100644 src/appeng/api/me/items/IAssemblerPatternItem.java create mode 100644 src/appeng/api/me/items/ILocationPatternItem.java create mode 100644 src/appeng/api/me/items/IMEPatternItem.java create mode 100644 src/appeng/api/me/items/IMemoryCard.java create mode 100644 src/appeng/api/me/items/IStorageCell.java create mode 100644 src/appeng/api/me/items/IStorageComponent.java create mode 100644 src/appeng/api/me/tiles/IAssemblerMB.java create mode 100644 src/appeng/api/me/tiles/IAssemblerPatternProvider.java create mode 100644 src/appeng/api/me/tiles/ICellContainer.java create mode 100644 src/appeng/api/me/tiles/ICellProvider.java create mode 100644 src/appeng/api/me/tiles/IColoredMETile.java create mode 100644 src/appeng/api/me/tiles/IConfigureableTile.java create mode 100644 src/appeng/api/me/tiles/IConnectionSensitive.java create mode 100644 src/appeng/api/me/tiles/IDirectionalMETile.java create mode 100644 src/appeng/api/me/tiles/IExtendedCellProvider.java create mode 100644 src/appeng/api/me/tiles/IFulllyOptionalMETile.java create mode 100644 src/appeng/api/me/tiles/IGridMachine.java create mode 100644 src/appeng/api/me/tiles/IGridTeleport.java create mode 100644 src/appeng/api/me/tiles/IGridTileEntity.java create mode 100644 src/appeng/api/me/tiles/ILocateable.java create mode 100644 src/appeng/api/me/tiles/IMEPowerStorage.java create mode 100644 src/appeng/api/me/tiles/INonSignalBlock.java create mode 100644 src/appeng/api/me/tiles/IOptionalMETile.java create mode 100644 src/appeng/api/me/tiles/IOrientableTile.java create mode 100644 src/appeng/api/me/tiles/IPriorityTile.java create mode 100644 src/appeng/api/me/tiles/IPushable.java create mode 100644 src/appeng/api/me/tiles/IStorageAware.java create mode 100644 src/appeng/api/me/tiles/IStorageMonitor.java create mode 100644 src/appeng/api/me/tiles/ITileCable.java create mode 100644 src/appeng/api/me/tiles/ITileIOCable.java create mode 100644 src/appeng/api/me/tiles/ITileInterfaceApi.java create mode 100644 src/appeng/api/me/tiles/InterfaceCraftingPattern.java create mode 100644 src/appeng/api/me/util/Grid.java create mode 100644 src/appeng/api/me/util/IAssemblerCluster.java create mode 100644 src/appeng/api/me/util/IAssemblerPattern.java create mode 100644 src/appeng/api/me/util/IConfigManager.java create mode 100644 src/appeng/api/me/util/ICraftRequest.java create mode 100644 src/appeng/api/me/util/ICraftWatcher.java create mode 100644 src/appeng/api/me/util/IGridCache.java create mode 100644 src/appeng/api/me/util/IGridInterface.java create mode 100644 src/appeng/api/me/util/ILocationPattern.java create mode 100644 src/appeng/api/me/util/IMEInventory.java create mode 100644 src/appeng/api/me/util/IMEInventoryHandler.java create mode 100644 src/appeng/api/me/util/IMEInventoryUtil.java create mode 100644 src/appeng/api/me/util/InterfaceCraftingResponse.java diff --git a/src/appeng/api/Blocks.java b/src/appeng/api/Blocks.java new file mode 100644 index 00000000000..50ab002b504 --- /dev/null +++ b/src/appeng/api/Blocks.java @@ -0,0 +1,67 @@ +package appeng.api; + +import net.minecraft.item.ItemStack; + +/** + * Blocks, all of the Blocks in AE. + * DO NOT USE THESE WITHOUT COPYING THEM : ItemStack.copy() - is your friend. + */ + +public class Blocks +{ + // World Gen + public static ItemStack blkQuartzOre; + public static ItemStack blkQuartz; + + // Tech 1 ( non-ME ) + public static ItemStack blkGrinder; + + // Tech 4? ( ME Storage ) + public static ItemStack blkCable_Colored[]; + + public static ItemStack blkAssembler; + public static ItemStack blkController; + public static ItemStack blkDrive; + public static ItemStack blkPatternEncoder; + public static ItemStack blkWireless; + public static ItemStack blkTerminal; + public static ItemStack blkChest; + public static ItemStack blkInterface; + public static ItemStack blkPartitioner; + public static ItemStack blkCraftingTerminal; + public static ItemStack blkStorageBus; + + public static ItemStack blkAssemblerFieldWall; + public static ItemStack blkHeatVent; + public static ItemStack blkCraftingAccelerator; + + public static ItemStack blkInputCablePrecision; + public static ItemStack blkInputCableFuzzy; + public static ItemStack blkInputCableBasic; + + public static ItemStack blkOutputCablePrecision; + public static ItemStack blkOutputCableFuzzy; + public static ItemStack blkOutputCableBasic; + public static ItemStack blkStorageBusFuzzy; + + public static ItemStack blkLevelEmitter; + public static ItemStack blkDarkCable; + public static ItemStack blkIOPort; + public static ItemStack blkCraftingMonitor; + public static ItemStack blkStorageMonitor; + public static ItemStack blkColorlessCable; + public static ItemStack blkColorlessCableCovered; + + public static ItemStack blkTransitionPlane; + public static ItemStack blkCondenser; + public static ItemStack blkEnergyCell; + public static ItemStack blkPowerRelay; + public static ItemStack blkQuantumRing; + public static ItemStack blkQuantumLink; + public static ItemStack blkQuartzGlass; + public static ItemStack blkQuartzLamp; + + // Used internally, best not to mess with this one... + public static ItemStack blkPhantom; + +} diff --git a/src/appeng/api/DimentionalCoord.java b/src/appeng/api/DimentionalCoord.java new file mode 100644 index 00000000000..acf17c2bfbd --- /dev/null +++ b/src/appeng/api/DimentionalCoord.java @@ -0,0 +1,58 @@ +package appeng.api; + +import net.minecraft.world.World; + +public class DimentionalCoord extends WorldCoord +{ + private World w; + private int dimId; + + public DimentionalCoord( DimentionalCoord s ) + { + super( s.x, s.y, s.z ); + w = s.w; + dimId = s.dimId; + } + + public DimentionalCoord( World _w, int _x, int _y, int _z ) + { + super(_x, _y, _z); + w = _w; + dimId = _w.provider.dimensionId; + } + + @Override + public DimentionalCoord copy() + { + return new DimentionalCoord( this ); + } + + public boolean isEqual( DimentionalCoord c ) + { + return x == c.x && y == c.y && z == c.z && c.w == this.w; + } + + @Override + public boolean equals(Object obj) + { + if ( obj instanceof DimentionalCoord ) + return isEqual( (DimentionalCoord)obj ); + return false; + } + + @Override + public int hashCode() + { + return super.hashCode() ^ dimId; + } + + public boolean isInWorld(World world) + { + return w == world; + } + + public World getWorld() + { + return w; + } +} diff --git a/src/appeng/api/IAEItemStack.java b/src/appeng/api/IAEItemStack.java new file mode 100644 index 00000000000..4b55ab5eb6b --- /dev/null +++ b/src/appeng/api/IAEItemStack.java @@ -0,0 +1,175 @@ +package appeng.api; + +import java.io.DataOutputStream; +import java.io.IOException; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +/** + * An alternate version of ItemStack for AE to keep tabs on things easier, and to support larger storage. + * stackSizes of getItemStack will be capped. + * + * You may hold on to these if you want, just make sure you let go of them when your not using them. + * + * Don't Implement. + * + * Construct with Util.createItemStack( ItemStack ) + * + */ +public interface IAEItemStack +{ + /** + * seriously? + * @return the item id of the requested item. + */ + public int getItemID(); + + /** + * the item's damage. + * @return + */ + public int getItemDamage(); + + /** + * obtain the NBT Data for the item. + * @return + */ + public IAETagCompound getTagCompound(); + + /** + * creates a standard MC ItemStack for the item. + * @return new itemstack + */ + public ItemStack getItemStack(); + + /** + * create a AE Item clone. + * @return the copy. + */ + public IAEItemStack copy(); + + /** + * number of items in the stack. + * @return basically ItemStack.stackSize + */ + public long getStackSize(); + + /** + * changes the number of items in the stack. + * @param basically, ItemStack.stackSize = N + */ + public void setStackSize( long stackSize ); + + /** + * Same as getStackSize, but for requestable items. ( LP ) + * @return basically itemStack.stackSize but for requestable items. + */ + long getCountRequestable(); + + /** + * Same as setStackSize, but for requestable items. ( LP ) + * @return basically itemStack.stackSize = N but for setStackSize items. + */ + void setCountRequestable(long countRequestable); + + /** + * true, if the item can be crafted. + * @return true, if it can be crafted. + */ + boolean isCraftable(); + + /** + * change weather the item can be crafted. + * @param isCraftable + */ + void setCraftable(boolean isCraftable); + + /** + * basically itemid and damage in one number.. + * @return + */ + int getDef(); + + /** + * clears, requsetable, craftable, and stack sizes. + */ + public void reset(); + + /** + * returns true, if the item can be crafted, requested, or extracted. + * @return isThisRecordMeaningful + */ + boolean isMeaninful(); + + /** + * is there NBT Data for this item? + * @return if there is. + */ + boolean hasTagCompound(); + + /** + * Combines two IAEItemStacks via addition. + * @param option, to add to the current one. + */ + void add(IAEItemStack option); + + /** + * Adds more to the stack size... + * @param i + */ + void incStackSize(long i); + + /** + * removes some from the stack size. + */ + void decStackSize(long i); + + /** + * adds items to the requestable + * @param i + */ + void incCountRequestable(long i); + + /** + * removes items from the requsetable + * @param i + */ + void decCountRequestable(long i); + + /** + * quick way to get access to the MC Item Definition. + * @return + */ + Item getItem(); + + /** + * write to a NBTTagCompound. + * @param i + */ + void writeToNBT(NBTTagCompound i); + + /** + * Compare a IAEItemStack to another AEItemStack or a ItemStack. + * @param obj + * @return true if they are the same. + */ + @Override + public boolean equals(Object obj); + + /** + * Compare the Ore Dictionary ID for this to another item. + * @param oreID + * @return + */ + public boolean sameOre( Object oreID ); + + /** + * Slower for disk saving, but smaller/more efficient for packets. + * @param data + * @throws IOException + */ + public void writeToPacket(DataOutputStream data) throws IOException; + +} diff --git a/src/appeng/api/IAETagCompound.java b/src/appeng/api/IAETagCompound.java new file mode 100644 index 00000000000..c7c48c7c4f7 --- /dev/null +++ b/src/appeng/api/IAETagCompound.java @@ -0,0 +1,33 @@ +package appeng.api; + +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; + +/** + * Don't cast this... either compare with it, or copy it. + * + * Don't Implement. + */ +public interface IAETagCompound { + + /** + * Create a copy ( the copy will not be a IAETagCompount, it will be a NBTTagCompound. ) + * @return + */ + NBTTagCompound clone(); + + /** + * compare to other NBTTagCompounds or IAETagCompounds + * @param a + * @return true, if they are the same. + */ + @Override + boolean equals( Object a ); + + /** + * returns the special comparison for this tag. + * @return + */ + IItemComparison getSpecialComparison(); + +} diff --git a/src/appeng/api/IAppEngApi.java b/src/appeng/api/IAppEngApi.java new file mode 100644 index 00000000000..b65d26594b6 --- /dev/null +++ b/src/appeng/api/IAppEngApi.java @@ -0,0 +1,161 @@ +package appeng.api; + +import appeng.api.me.items.IMemoryCard; +import appeng.api.me.tiles.IColoredMETile; +import appeng.api.me.util.IAssemblerPattern; +import appeng.api.me.util.IMEInventory; +import appeng.api.me.util.IMEInventoryUtil; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.world.World; + +public interface IAppEngApi { + + /** + * Attempts to paint the block at the specified coords, the specified color, colors are based off of IColoredMETile.Colors + * @param world + * @param x + * @param y + * @param z + * @param color + * @return if the block was painted, or not you can use this to damage your item if you want. + */ + boolean paintBlock(World world, int x, int y, int z, int color); + + /** + * Add new Grid Caches for use during run time, only use during loading phase. + * @return + */ + IGridCacheRegistry getGridCacheRegistry(); + + /** + * Add additional storage bus handlers to improve interplay with mod blocks that contains special inventories that function unlike vanilla chests. + * AE uses this internally for barrels, dsu's, quantum chests, AE Networks and more. * + * @return IExternalStorageRegistry + */ + IExternalStorageRegistry getExternalStorageRegistry(); + + /** + * Add additional special comparison functionality, AE Uses this internally for Bees. + * @return ISpecialComparisonRegistry + */ + ISpecialComparisonRegistry getSpecialComparsonRegistry(); + + /** + * gives you access to extractItemsByRecipe, other then this theres not much use for this. + * @param mei + * @return + */ + IMEInventoryUtil getIMEInventoryUtil(IMEInventory mei); + + /** + * Lets you register your items as wireless terminals + * @return + */ + IWirelessTermRegistery getWirelessRegistry(); + + /** + * return an locateable object by its serial + * used internally by AE for QNBs / Network Controllers + * @param serial + * @return + */ + Object getLocateableBySerial(Long serial); + + /** + * creates a new instance of IAEItemStack from a MC ItemStack + * @param is + * @return + */ + IAEItemStack createItemStack(ItemStack is); + + /** + * Creates a new instance of IItemList + * @return + */ + IItemList createItemList(); + + /** + * Allows you to register new cell types, these will function in drives + * @return + */ + ICellRegistry getCellRegistry(); + + /** + * Manage grinder recipes via API + * @return + */ + IGrinderRecipeManager getGrinderRecipeManage(); + + /** + * get access to the locatable registry + * @return + */ + ILocateableRegistry getLocateableRegistry(); + + /** + * a simple wrapper around the AEItemStack version on IMEInventory + * @param inv + * @param is + * @return + */ + ItemStack addItemsToInv(IMEInventory inv, ItemStack is); + + /** + * a simple wrapper around the AEItemStack version on IMEInventory + * @param inv + * @param is + * @return + */ + ItemStack extractItems(IMEInventory inv, ItemStack is); + + /** + * Blacklist this item from vanilla AE Terminals / IStorageCell + * @param itemID + * @param meta - if you use OreDictionary.WILDCARD_VALUE it will blacklist the entire itemID. + */ + void addBasicBlackList(int itemID, int meta); + + /** + * Acquire the inventory for a IStorageCell + * @param i + * @return + */ + IMEInventory getBasicCell(ItemStack i); + + /** + * checks if the item is a basic storage cell. + * @param i + * @return + */ + Boolean isBasicCell(ItemStack i); + + /** + * gives you access to assembler pattern inventories. + * @param i + * @return + */ + IAssemblerPattern getAssemblerPattern(ItemStack i); + + /** + * allows you to check if an item is an assembler pattern. + * @param i + * @return + */ + Boolean isAssemblerPattern(ItemStack i); + + /** + * allows you to check if a pattern is blank. + * @param i + * @return + */ + Boolean isBlankPattern(ItemStack i); + + /** + * gives you the ability to interface with AE Memory Cards. + * @return + */ + IMemoryCard getMemoryCardHandler(); + +} diff --git a/src/appeng/api/IAppEngGrinderRecipe.java b/src/appeng/api/IAppEngGrinderRecipe.java new file mode 100644 index 00000000000..b8a3f058995 --- /dev/null +++ b/src/appeng/api/IAppEngGrinderRecipe.java @@ -0,0 +1,45 @@ +package appeng.api; + +import net.minecraft.item.ItemStack; + +/** + * Lets you manipulate existing recipes. + */ +public interface IAppEngGrinderRecipe { + + /** + * the current input + * @return input that the grinder will accept. + */ + public ItemStack getInput(); + + /** + * lets you change the grinder recipe by changing its input. + * @param input + */ + public void setInput( ItemStack input ); + + /** + * gets the current output + * @return output that the grinder will produce + */ + public ItemStack getOutput(); + + /** + * allows you to change the output. + * @param output + */ + public void setOutput( ItemStack output ); + + /** + * Energy cost, in turns. + * @return number of turns it takes to produce the output from the input. + */ + public int getEnergyCost(); + + /** + * Allows you to adjust the number of turns + * @param new number of turns to produce output. + */ + public void setEnergyCost(int c); +} diff --git a/src/appeng/api/ICellHandler.java b/src/appeng/api/ICellHandler.java new file mode 100644 index 00000000000..e0070b1ea79 --- /dev/null +++ b/src/appeng/api/ICellHandler.java @@ -0,0 +1,25 @@ +package appeng.api; + +import net.minecraft.item.ItemStack; +import appeng.api.me.util.IMEInventoryHandler; + +/** + * Registratio record for a Custom Cell handler. + */ +public interface ICellHandler { + + /** + * return true if the provided item is handled by your cell handler. ( AE May choose to skip this method, and just request a handler ) + * @param is + * @return return true, if getCellHandler will not return null. + */ + boolean isCell( ItemStack is ); + + /** + * return a new IMEHandler for the provided item. + * @param is + * @return if you cannot handle the provided item, return null. + */ + IMEInventoryHandler getCellHandler( ItemStack is ); + +} diff --git a/src/appeng/api/ICellRegistry.java b/src/appeng/api/ICellRegistry.java new file mode 100644 index 00000000000..2e609301e9b --- /dev/null +++ b/src/appeng/api/ICellRegistry.java @@ -0,0 +1,31 @@ +package appeng.api; + +import net.minecraft.item.ItemStack; +import appeng.api.me.util.IMEInventoryHandler; + +/** + * Storage Cell Registry, used for specially implemented cells, if you just want to make a item act like a cell, or new cell with diffrent bytes, then you should probobly consider IStorageCell instead its consideriablly simpler. + */ +public interface ICellRegistry { + + /** + * Register a new handler. + * @param h + */ + void addCellHandler( ICellHandler h ); + + /** + * returns true if the provided item, can be handled by a handler in AE, ( AE May choose to skip this and just get the handler instead. ) + * @param is + * @return returns true, if you can get a InventoryHandler for the item passed. + */ + boolean isCellHandled( ItemStack is ); + + /** + * returns an IMEInventoryHandler for the provided item. + * @param is + * @return new IMEInventoryHandler, or null if there isn't one. + */ + IMEInventoryHandler getHandlerForCell( ItemStack is ); + +} diff --git a/src/appeng/api/IExternalStorageHandler.java b/src/appeng/api/IExternalStorageHandler.java new file mode 100644 index 00000000000..be14dcc68f5 --- /dev/null +++ b/src/appeng/api/IExternalStorageHandler.java @@ -0,0 +1,27 @@ +package appeng.api; + +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; +import appeng.api.me.util.IMEInventory; + +/** + * A Registration for a special storage handler. + * + */ +public interface IExternalStorageHandler { + + /** + * if this can handle the provided inventory, return true. ( Generally skipped by AE, and it just calls getInventory ) + * @param te + * @return true, if it can get a handler via getInventory + */ + boolean canHandle( TileEntity te, ForgeDirection d ); + + /** + * if this can handle the given inventory, return the a IMEInventory implemnting class for it, if not return null + * @param te + * @return HandlerFor Inventory. + */ + IMEInventory getInventory( TileEntity te, ForgeDirection d ); + +} diff --git a/src/appeng/api/IExternalStorageRegistry.java b/src/appeng/api/IExternalStorageRegistry.java new file mode 100644 index 00000000000..0f4c635257e --- /dev/null +++ b/src/appeng/api/IExternalStorageRegistry.java @@ -0,0 +1,22 @@ +package appeng.api; + +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; + +public interface IExternalStorageRegistry { + + /** + * A registry for StorageBus interactions + * @param ei + */ + void addExternalStorageInterface( IExternalStorageHandler ei ); + + /** + * returns the handler for a given tile / forge direction. + * @param te + * @param opposite + * @return + */ + IExternalStorageHandler getHandler(TileEntity te, ForgeDirection opposite); + +} diff --git a/src/appeng/api/IGridCacheRegistry.java b/src/appeng/api/IGridCacheRegistry.java new file mode 100644 index 00000000000..13e188f5c92 --- /dev/null +++ b/src/appeng/api/IGridCacheRegistry.java @@ -0,0 +1,24 @@ +package appeng.api; + +import appeng.api.me.util.IGridCache; + +/** + * A registry of grid caches to extend grid functionality. + */ +public interface IGridCacheRegistry { + + /** + * Register a new grid cache for use during operation, must be called during the loading phase. + * @param cl + * @return cache id ( can be used later to ask the grid for you cache. ) + */ + int registerGridCache( Class cl ); + + /** + * requests a new instance of a grid cache for use, used internally + * @param id + * @return + */ + IGridCache[] createCacheInstance(); + +} diff --git a/src/appeng/api/IGrinderRecipeManager.java b/src/appeng/api/IGrinderRecipeManager.java new file mode 100644 index 00000000000..16b60830538 --- /dev/null +++ b/src/appeng/api/IGrinderRecipeManager.java @@ -0,0 +1,32 @@ +package appeng.api; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +/** + * Lets you manipulate Grinder Recipes, by adding or editing existing ones. + */ +public interface IGrinderRecipeManager { + + /** + * Current list of registered recipes, you can modify this if you want too. + * @return currentlyRegistredRecipes + */ + public List getRecipes(); + + /** + * add a new recipe the easy way, in -> out, how many turns. + * @param in + * @param out + * @param cost + */ + public void addRecipe( ItemStack in, ItemStack out, int cost ); + + /** + * Searches for a recipe for a given input, and returns it. + * @param input + * @return identified recipe, or null + */ + public IAppEngGrinderRecipe getRecipeForInput(ItemStack input); +} diff --git a/src/appeng/api/IItemComparisionProvider.java b/src/appeng/api/IItemComparisionProvider.java new file mode 100644 index 00000000000..b93194e02db --- /dev/null +++ b/src/appeng/api/IItemComparisionProvider.java @@ -0,0 +1,25 @@ +package appeng.api; + +import net.minecraft.item.ItemStack; + +/** + * Provider for special comparisons. + * when an item is encountered AE Will request if the comparison function handles the item, by trying to request a IItemComparison class. + */ +public interface IItemComparisionProvider { + + /** + * should return a new IItemComparison, or return null if it dosn't handle the supplied item. + * @param is + * @return IItemComparison, or null + */ + IItemComparison getComparison( ItemStack is ); + + /** + * Simple test for support ( AE generally skips this and calls the above function. ) + * @param stack + * @return true, if getComparison will return a valid IItemComparison Object. + */ + public boolean canHandle( ItemStack stack); + +} diff --git a/src/appeng/api/IItemComparison.java b/src/appeng/api/IItemComparison.java new file mode 100644 index 00000000000..4bfc35f9c29 --- /dev/null +++ b/src/appeng/api/IItemComparison.java @@ -0,0 +1,10 @@ +package appeng.api; + + +public interface IItemComparison { + + public boolean sameAsPrecise( IItemComparison comp); + + public boolean sameAsFuzzy(IItemComparison comp); + +} diff --git a/src/appeng/api/IItemList.java b/src/appeng/api/IItemList.java new file mode 100644 index 00000000000..9f722000f5a --- /dev/null +++ b/src/appeng/api/IItemList.java @@ -0,0 +1,32 @@ +package appeng.api; + +import java.util.Iterator; +import java.util.List; + +import net.minecraft.item.ItemStack; + +/** + * Represents a list of items in AE. + * + * Don't Implement. + * + * Construct with Util.createItemList() + * + */ +public interface IItemList extends Iterable +{ + public void addStorage( IAEItemStack option ); // adds a stack as stored. + public void addCrafting( IAEItemStack option ); // adds a stack as craftable. + public void addRequestable( IAEItemStack option ); // adds a stack as requestable. + public void add( IAEItemStack option ); // adds stack as is. + + IAEItemStack getFirstItem(); + + public List getItems(); + IAEItemStack findItem(IAEItemStack i); + int size(); + + @Override + public Iterator iterator(); + public void setCurrentPriority(int priority); +} diff --git a/src/appeng/api/ILocateableRegistry.java b/src/appeng/api/ILocateableRegistry.java new file mode 100644 index 00000000000..8e75cbef6c6 --- /dev/null +++ b/src/appeng/api/ILocateableRegistry.java @@ -0,0 +1,15 @@ +package appeng.api; + +/** + * A Registry for locatable items, works based on serial numbers. + */ +public interface ILocateableRegistry { + + /** + * Attempts to find the object with the serial specifed, if it can it returns the object. + * @param ser + * @return requestedObject, or null + */ + public abstract Object findLocateableBySerial(long ser); + +} \ No newline at end of file diff --git a/src/appeng/api/ISpecialComparisonRegistry.java b/src/appeng/api/ISpecialComparisonRegistry.java new file mode 100644 index 00000000000..0a30baecf1e --- /dev/null +++ b/src/appeng/api/ISpecialComparisonRegistry.java @@ -0,0 +1,24 @@ +package appeng.api; + +import net.minecraft.item.ItemStack; + +/** + * A Registry of any special comparison handlers for AE To use. + * + */ +public interface ISpecialComparisonRegistry { + + /** + * returns a handler it found for a specific item. + * @param stack + * @return TheHandler or null + */ + IItemComparison getSpecialComparion( ItemStack stack ); + + /** + * Register a new cpecial comparison function with AE. + * @param prov + */ + public void addComparisonProvider( IItemComparisionProvider prov ); + +} diff --git a/src/appeng/api/IWirelessTermHandler.java b/src/appeng/api/IWirelessTermHandler.java new file mode 100644 index 00000000000..c38c7ee00a9 --- /dev/null +++ b/src/appeng/api/IWirelessTermHandler.java @@ -0,0 +1,49 @@ +package appeng.api; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.network.Player; + +/** + * A handler for a wireless terminal. + */ +public interface IWirelessTermHandler { + + /** + * return true, if usePower, hasPower, ect... can be called for the provided item. + * @param is + * @return + */ + boolean canHandle( ItemStack is ); + + /** + * use an amount of power, in AE units + * @param amount is in AE units ( 5 per MJ ), if you return false, the item should be dead and return false for hasPower + * @param is + * @return + */ + boolean usePower( Player player, float amount, ItemStack is ); + + /** + * gets the power status of the item. + * @param is + * @return returns true if there is any power left. + */ + boolean hasPower( Player player, ItemStack is ); + + /** + * Used to get the current key from the item. + * @param player + * @param item + * @return + */ + String getEncryptionKey( ItemStack item ); + + /** + * Encode the wireless frequency via the Controller. + * @param item - the wireless terminal. + * @param encKey - the wireless encryption key. + * @param name - null for now. + */ + void setEncryptionKey( ItemStack item, String encKey, String name ); +} diff --git a/src/appeng/api/IWirelessTermRegistery.java b/src/appeng/api/IWirelessTermRegistery.java new file mode 100644 index 00000000000..b9b0a483356 --- /dev/null +++ b/src/appeng/api/IWirelessTermRegistery.java @@ -0,0 +1,38 @@ +package appeng.api; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import appeng.api.me.util.IMEInventoryHandler; + +/** + * Registratio record for a Custom Cell handler. + */ +public interface IWirelessTermRegistery { + + /** + * add thsi handler to the list of other wireless handler. + * @param handler + */ + void registerWirelessHandler( IWirelessTermHandler handler ); + + /** + * returns true if theres a handler for this item. + * @param is + * @return + */ + boolean isWirelessTerminal( ItemStack is ); + + /** + * returns a register handler for the item in question, or null if there isn't one. + * @param is + * @return + */ + IWirelessTermHandler getWirelessTerminalHandler( ItemStack is ); + + /** + * opens the wireless terminal gui, the wireless terminal item, must be in the active slot on the tool bar. + */ + void OpenWirelessTermainlGui( ItemStack item, World w, EntityPlayer player ); + +} diff --git a/src/appeng/api/Items.java b/src/appeng/api/Items.java new file mode 100644 index 00000000000..0c75f82ab5a --- /dev/null +++ b/src/appeng/api/Items.java @@ -0,0 +1,36 @@ +package appeng.api; + +import net.minecraft.item.ItemStack; + +/** + * Items that have data, actions, or other interesting properties... + * DO NOT USE THESE WITHOUT COPYING THEM : ItemStack.copy() - is your friend. + */ +public class Items +{ + public static ItemStack toolQuartzAxe; + public static ItemStack toolQuartzHoe; + public static ItemStack toolQuartzShovel; + public static ItemStack toolQuartzPick; + public static ItemStack toolQuartzSword; + public static ItemStack toolQuartzWrench; + + public static ItemStack toolEntropyAccelerator; + public static ItemStack toolVibrationCatalyst; + public static ItemStack toolMassCannon; + + public static ItemStack toolQuartzKnife; + + public static ItemStack itemMemoryCard; + + public static ItemStack itemCell1k; + public static ItemStack itemCell4k; + public static ItemStack itemCell16k; + public static ItemStack itemCell64k; + + public static ItemStack itemEncodedAsemblerPattern; + public static ItemStack toolWirelessTerminal; + + @Deprecated + public static ItemStack itemWirelessTerminal; +} diff --git a/src/appeng/api/Materials.java b/src/appeng/api/Materials.java new file mode 100644 index 00000000000..c6d8e90cd66 --- /dev/null +++ b/src/appeng/api/Materials.java @@ -0,0 +1,58 @@ +package appeng.api; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +/** + * Access to stack-able simple items, these include resources... + * Craftable ingredients, and a few simple items that don't have log of their own... + * DO NOT USE THESE WITHOUT COPYING THEM : ItemStack.copy() - is your friend. + */ +public class Materials +{ + // Tech 1 + public static ItemStack matWoodenGear; + public static ItemStack matIronNugget; + public static ItemStack matCrank; + + // Grinder... + public static ItemStack matQuartzDustNether; + public static ItemStack matQuartzDust; + public static ItemStack matIronDust; + public static ItemStack matGoldDust; + public static ItemStack matFlour; + + // Tech 3 + public static ItemStack matSilicon; + public static ItemStack matProcessorBasicUncooked; + public static ItemStack matProcessorAdvancedUncooked; + public static ItemStack matProcessorBasic; + public static ItemStack matProcessorAdvanced; + + // ME Construction... + public static ItemStack matConversionMatrix; + public static ItemStack matStorageCell; + public static ItemStack matStorageBlock; + public static ItemStack matStorageCluster; + public static ItemStack matWireless; + public static ItemStack matStorageCellHouseing; + public static ItemStack matStorageCellHouseingFuzzy; + public static ItemStack matBlankPattern; + public static ItemStack matStorageSegment; + public static ItemStack matFluxDust; + public static ItemStack matFluxCrystal; + public static ItemStack matFluxPearl; + + // World gen... + public static ItemStack matQuartz; + + // Other items, such as upgrades. + public static ItemStack matWirelessBooster; + public static ItemStack matMatterBall; + public static ItemStack matSingularity; + public static ItemStack matEnderPearlDust; + public static ItemStack matQuantumEntangledSingularity; + + // TEST ITEMS! + public static ItemStack testItem; +} diff --git a/src/appeng/api/README.txt b/src/appeng/api/README.txt new file mode 100644 index 00000000000..bcd69c4e897 --- /dev/null +++ b/src/appeng/api/README.txt @@ -0,0 +1,46 @@ +If your considering using the AE API, please take a moment to read though the following. + +Before we begin, + AE's API will change as new features are added to the mod, I try to keep + the changes to a minimum and try to prevent breaking changes, however it will + probably happen at some point, and it can't truly be avoided in some cases. + +The Grid + AE refers to the "ME Network" internally as "The Grid" you will see methods such + as getGrid(), setGrid() commonly, most interaction with networks, and creating new + network blocks will involve the grid. + +Network Enumeration + If your trying to add a new ME Network Block, you must at minimum implement + IGridTileEntity, and post the GridTileLoadEvent, and GridTileUnloadEvent when your + tile is added / removed respectfully, if you fail to do this correctly, your tile, + may ghost in the network, or cause invalid behaviour. You must inform AE that your + tiles is joining and exiting the Network, with these events or you will not get notified + of any network related features. + +Thread Safety + AE is not thread safe, do not attempt to use the API from other threads, this will + result in crashes, and CME exceptions - and will not end well. + +Blocks / Items / Materials + AE Exposes its Original Item stacks via the Blocks, Items, Materials classes for easy access, + don't change these, if you need to use an item make sure you .copy() it and use the copy, if + failing to do so can result in dupe bugs irregular crafting patterns, and other issues. + +AE and ItemStacks / Item Lists + AE's API commonly refers to IAEItemStacks, and IItemLists this are internally implemented + classes in AE, Do not Implement IAEItemstack, or IItemList, use the util methods to + construct new instances them. + +API Conflicts / Inclusion + Refrain from including portions of the API as class files in your mod, unless required + because your implementing an interface, even then its greatly appreciated if you put in + the effort to get around this. + + If you are not sure how to do this and plan on releasing your mod, I will be happy to explain + what steps you can take to improve compatibility, and prevent conflicts no one likes crashes, + and these cause crashes. + +I've been trying to improve the documentation included in the API java files however things can be +confusing or misleading, if you have questions after trying to figure something out I'm usually +available on IRC. \ No newline at end of file diff --git a/src/appeng/api/TileRef.java b/src/appeng/api/TileRef.java new file mode 100644 index 00000000000..db6fe3e6ec2 --- /dev/null +++ b/src/appeng/api/TileRef.java @@ -0,0 +1,60 @@ +package appeng.api; + +import net.minecraft.client.Minecraft; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import appeng.api.events.GridTileUnloadEvent; +import appeng.api.exceptions.AppEngTileMissingException; +import appeng.api.me.tiles.IGridTileEntity; + +public class TileRef extends WorldCoord { + + //private int dimension; + private World w; + boolean wasGrid; + + public TileRef( TileEntity gte ) { + super( gte.xCoord, gte.yCoord, gte.zCoord ); + TileEntity te = gte; + wasGrid = te instanceof IGridTileEntity; + w = te.worldObj; + if ( te.worldObj == null ) + throw new RuntimeException("Tile has no world."); + } + + @SuppressWarnings("unchecked") + public T getTile() throws AppEngTileMissingException + { + // there might be a possible tick where we have TileRefs for unloaded tiles? + if ( w.getChunkProvider().chunkExists(x >> 4, z >> 4) ) + { + TileEntity te = w.getBlockTileEntity( x, y, z ); + if ( te != null ) + { + try + { + T ttt = (T) te; // I have no idea if this causes the exception or not... + return ttt; + } + catch( ClassCastException err ) + { + + } + } + } + + /** + * was this a grid tile? if so inform the grid enum that something has derped. + */ + if ( wasGrid ) + MinecraftForge.EVENT_BUS.post( new GridTileUnloadEvent( null, w, this ) ); + + throw new AppEngTileMissingException( w, x,y,z); + } + + public DimentionalCoord getCoord() { + return new DimentionalCoord( w, x, y, z ); + } + +}; diff --git a/src/appeng/api/Util.java b/src/appeng/api/Util.java new file mode 100644 index 00000000000..207d339d757 --- /dev/null +++ b/src/appeng/api/Util.java @@ -0,0 +1,230 @@ +package appeng.api; + +import java.lang.reflect.InvocationTargetException; + +import cpw.mods.fml.relauncher.ReflectionHelper; +import net.minecraft.item.ItemStack; +import appeng.api.me.util.IAssemblerPattern; +import appeng.api.me.util.IMEInventory; +import appeng.api.me.util.IMEInventoryHandler; +import appeng.api.me.util.IMEInventoryUtil; + +/** + * Returns useful stuff of various sorts to access internal features and stuff, the meat of the important stuff is accessed here... + * + * Available IMCs: + * "AppliedEnergistics", "add-grindable", "itemid,meta,itemid,meta,effort" + * "AppliedEnergistics", "blacklist-cell" "itemid[,meta]" + * "AppliedEnergistics", "blacklist-transitionplane" "itemid[,meta]" + * "AppliedEnergistics", "whitelist-transitionplane" "itemid[,meta]" + * + */ +public class Util +{ + static private IAppEngApi api = null; + + /** + * All future API calls should be made via this method. + * @return + */ + public static IAppEngApi getAppEngApi() + { + try { + Class c = ReflectionHelper.getClass( Util.class.getClassLoader(), "appeng.common.AppEngApi" ); + api = (IAppEngApi) c.getMethod( "getInstance" ).invoke( c ); + } catch ( Throwable e) { + return null; + } + return api; + } + + /** + * returns the wireless terminal registry. + * @return + */ + public static IWirelessTermRegistery getWirelessTermRegistery() + { + if ( api == null ) return null; + return api.getWirelessRegistry(); + } + + /** + * Find an object by its serial. + * @param ser + * @return LocatedObject or null + */ + public static Object getLocateableBySerial( long ser ) + { + if ( api == null ) return null; + return api.getLocateableBySerial( ser ); + } + + /** + * Creates a new AEItemstack. + * @param is + * @return newly generated AE Itemstack + */ + public static IAEItemStack createItemStack( ItemStack is ) + { + if ( api == null ) return null; + return api.createItemStack( is ); + } + + /** + * Simple Wrapper of the insertion process.. + * @param inv + * @param is + * @return ItemsNotInserted or null + */ + public static ItemStack addItemsToInv( IMEInventory inv, ItemStack is ) + { + if ( api == null ) return null; + return api.addItemsToInv( inv, is ); + } + + /** + * Simple Wrapper of the extraction process + * @param inv + * @param is + * @return ItemsExtracted or null + */ + public static ItemStack extractItemsFromInv( IMEInventory inv, ItemStack is ) + { + if ( api == null ) return null; + return api.extractItems( inv, is ); + } + + /** + * Create a new Blank ItemList + * @return new itemlist. + */ + public static IItemList createItemList() + { + if ( api == null ) return null; + return api.createItemList(); + } + + /** + * creates a new IMEInventoryUtil, only useful if you want to use the fancy get items by recipe functionaility. + * @param ime + * @return created InvUtil + */ + public static IMEInventoryUtil getIMEInventoryUtil( IMEInventory ime ) + { + if ( api == null ) return null; + return api.getIMEInventoryUtil( ime ); + } + + /** + * Gets the instance of the special comparison registry ( Bees / Trees ) that sort of stuff + * @return specialComparisonRegistry + */ + public static ISpecialComparisonRegistry getSpecialComparisonRegistry() + { + if ( api == null ) return null; + return api.getSpecialComparsonRegistry(); + } + + /** + * Gets the instance of the external storage registry - Storage Bus + * @return externStorgeRegitry + */ + public static IExternalStorageRegistry getExternalStorageRegistry() + { + if ( api == null ) return null; + return api.getExternalStorageRegistry(); + } + + /** + * Gets the instance of the Cell Registry + * @return returns the cell registry + */ + public static ICellRegistry getCellRegistry() + { + if ( api == null ) return null; + return api.getCellRegistry(); + } + + /** + * Gets instance for the grinder recipe manager. + * @return the grinder manager instance. + */ + public static IGrinderRecipeManager getGrinderRecipeManage() + { + if ( api == null ) return null; + return api.getGrinderRecipeManage(); + } + + /** Is it a Blank Pattern? */ + public static Boolean isBlankPattern(ItemStack i) + { + if ( api == null ) return null; + return api.isBlankPattern( i ); + } + + /** Is it an IAssemblerPattern? */ + public static Boolean isAssemblerPattern(ItemStack i) + { + if ( api == null ) return null; + return api.isAssemblerPattern( i ); + } + + /** Gets the IAssemblerPattern of the Assembly Pattern. */ + public static IAssemblerPattern getAssemblerPattern(ItemStack i) + { + if ( api == null ) return null; + return api.getAssemblerPattern( i ); + } + + /** Is it a IStorageCell, this will only return true for IStoreCells and not custom cells, you should probobly not use it unless you have a specific case. */ + public static Boolean isBasicCell(ItemStack i) + { + if ( api == null ) return null; + return api.isBasicCell( i ); + } + + /** + * if the item is a ME Compatible Storage Cell of any type. + * @param i + * @return true, if it is a storage call. + */ + public static Boolean isCell(ItemStack i) + { + if ( api == null ) return null; + return getCellRegistry().isCellHandled( i ); + } + + /** + * Gets the Interface to insert/extract from the Storage Cell for the item. + * @param i + * @return newly procured cell handler. + */ + public static IMEInventoryHandler getCell(ItemStack i) + { + if ( api == null ) return null; + return getCellRegistry().getHandlerForCell( i ); + } + + /** + * Lets you access internal storage of IStorageCell's + * @param i + * @return only works with Basic Cells, not custom ones, suggested not to use. + */ + public static IMEInventory getBasicCell(ItemStack i) + { + if ( api == null ) return null; + return api.getBasicCell( i ); + } + + /** + * Lets you blast list a specific item from being stored in basic cells, this works on any mod cells that use IStorageCell as well. + * @param ItemID + * @param Meta + */ + public static void addBasicBlackList( int ItemID, int Meta ) + { + if ( api == null ) return; + api.addBasicBlackList( ItemID, Meta ); + } + +} diff --git a/src/appeng/api/WorldCoord.java b/src/appeng/api/WorldCoord.java new file mode 100644 index 00000000000..4e5256478b5 --- /dev/null +++ b/src/appeng/api/WorldCoord.java @@ -0,0 +1,132 @@ +package appeng.api; + +import net.minecraftforge.common.ForgeDirection; + +/** + * This is used internally to return a location, in a few places, just use as is... + */ +public class WorldCoord +{ + public int x; + public int y; + public int z; + + public WorldCoord add(ForgeDirection direction, int length) + { + x += direction.offsetX * length; + y += direction.offsetY * length; + z += direction.offsetZ * length; + return this; + } + + public WorldCoord subtract(ForgeDirection direction, int length) + { + x -= direction.offsetX * length; + y -= direction.offsetY * length; + z -= direction.offsetZ * length; + return this; + } + + public WorldCoord add(int _x, int _y, int _z) + { + x += _x; + y += _y; + z += _z; + return this; + } + + public WorldCoord subtract(int _x, int _y, int _z) + { + x -= _x; + y -= _y; + z -= _z; + return this; + } + + public WorldCoord multiple(int _x, int _y, int _z) + { + x *= _x; + y *= _y; + z *= _z; + return this; + } + + public WorldCoord divide(int _x, int _y, int _z) + { + x /= _x; + y /= _y; + z /= _z; + return this; + } + + public WorldCoord(int _x, int _y, int _z) + { + x = _x; + y = _y; + z = _z; + } + + /** + * Will Return NULL if it's at some diagonal! + */ + public ForgeDirection DirectionTo(WorldCoord loc) + { + int ox = x - loc.x; + int oy = y - loc.y; + int oz = z - loc.z; + + int xlen = Math.abs( ox ); + int ylen = Math.abs( oy ); + int zlen = Math.abs( oz ); + + if ( loc.isEqual( this.copy().add( ForgeDirection.EAST, xlen ) ) ) + return ForgeDirection.EAST; + + if ( loc.isEqual( this.copy().add( ForgeDirection.WEST, xlen ) ) ) + return ForgeDirection.WEST; + + if ( loc.isEqual( this.copy().add( ForgeDirection.NORTH, zlen ) ) ) + return ForgeDirection.NORTH; + + if ( loc.isEqual( this.copy().add( ForgeDirection.SOUTH, zlen ) ) ) + return ForgeDirection.SOUTH; + + if ( loc.isEqual( this.copy().add( ForgeDirection.UP, ylen ) ) ) + return ForgeDirection.UP; + + if ( loc.isEqual( this.copy().add( ForgeDirection.DOWN, ylen ) ) ) + return ForgeDirection.DOWN; + + return null; + } + + public boolean isEqual( WorldCoord c ) + { + return x == c.x && y == c.y && z == c.z; + } + + public WorldCoord copy() + { + return new WorldCoord( x, y, z ); + } + + @Override + public boolean equals(Object obj) + { + if ( obj instanceof WorldCoord ) + return isEqual( (WorldCoord)obj ); + return false; + } + + @Override + public String toString() + { + return "" + x + "," + y + "," + z; + } + + @Override + public int hashCode() + { + return (y << 24) ^ x ^ z; + } +} diff --git a/src/appeng/api/config/ActionItems.java b/src/appeng/api/config/ActionItems.java new file mode 100644 index 00000000000..ff4559de487 --- /dev/null +++ b/src/appeng/api/config/ActionItems.java @@ -0,0 +1,17 @@ +package appeng.api.config; + + +public enum ActionItems implements IConfigEnum { + Wrench, + Close; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "FuzzyMode"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/CondenserOuput.java b/src/appeng/api/config/CondenserOuput.java new file mode 100644 index 00000000000..2c187dae508 --- /dev/null +++ b/src/appeng/api/config/CondenserOuput.java @@ -0,0 +1,19 @@ +package appeng.api.config; + + +public enum CondenserOuput implements IConfigEnum { + Trash, + MatterBalls, + Singularity; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "CondenserOutput"; + } + +} \ No newline at end of file diff --git a/src/appeng/api/config/EnableDisable.java b/src/appeng/api/config/EnableDisable.java new file mode 100644 index 00000000000..20c195bbe7e --- /dev/null +++ b/src/appeng/api/config/EnableDisable.java @@ -0,0 +1,18 @@ +package appeng.api.config; + + +public enum EnableDisable implements IConfigEnum { + Enabled, + Disabled; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "CondenserOutput"; + } + +} \ No newline at end of file diff --git a/src/appeng/api/config/FullnessMode.java b/src/appeng/api/config/FullnessMode.java new file mode 100644 index 00000000000..a3f79f4b6f2 --- /dev/null +++ b/src/appeng/api/config/FullnessMode.java @@ -0,0 +1,19 @@ +package appeng.api.config; + + +// do not change names.. +public enum FullnessMode implements IConfigEnum { + Empty, + Half, + Full; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "FullnessMode"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/FuzzyMode.java b/src/appeng/api/config/FuzzyMode.java new file mode 100644 index 00000000000..40d571277d1 --- /dev/null +++ b/src/appeng/api/config/FuzzyMode.java @@ -0,0 +1,27 @@ +package appeng.api.config; + + +public enum FuzzyMode implements IConfigEnum { + IgnoreAll(-1.0F), + Percent_99(1.0F), + Percent_75(0.75F), + Percent_50(0.5F), + Percent_25(0.25F); + + public float breakPoint; + + private FuzzyMode( float p ) + { + breakPoint = p; + } + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "FuzzyMode"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/IConfigEnum.java b/src/appeng/api/config/IConfigEnum.java new file mode 100644 index 00000000000..18bafec7791 --- /dev/null +++ b/src/appeng/api/config/IConfigEnum.java @@ -0,0 +1,11 @@ +package appeng.api.config; + +public interface IConfigEnum { + + IConfigEnum[] getValues(); + + int ordinal(); + + String getName(); + +} diff --git a/src/appeng/api/config/InterfaceBlockingMode.java b/src/appeng/api/config/InterfaceBlockingMode.java new file mode 100644 index 00000000000..08978d20ae3 --- /dev/null +++ b/src/appeng/api/config/InterfaceBlockingMode.java @@ -0,0 +1,17 @@ +package appeng.api.config; + +public enum InterfaceBlockingMode implements IConfigEnum { + NonBlocking, + Blocking; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "InterfaceBlockingMode"; + } + +} \ No newline at end of file diff --git a/src/appeng/api/config/InterfaceCraftingMode.java b/src/appeng/api/config/InterfaceCraftingMode.java new file mode 100644 index 00000000000..ce783b4286e --- /dev/null +++ b/src/appeng/api/config/InterfaceCraftingMode.java @@ -0,0 +1,17 @@ +package appeng.api.config; + +public enum InterfaceCraftingMode implements IConfigEnum { + Craft, + DontCraft; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "InterfaceCraftingMode"; + } + +} diff --git a/src/appeng/api/config/ItemFlow.java b/src/appeng/api/config/ItemFlow.java new file mode 100644 index 00000000000..b7d60cd6d64 --- /dev/null +++ b/src/appeng/api/config/ItemFlow.java @@ -0,0 +1,18 @@ +package appeng.api.config; + + +public enum ItemFlow implements IConfigEnum { + + READ, WRITE, READ_WRITE; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "ItemFlow"; + } + +} \ No newline at end of file diff --git a/src/appeng/api/config/ListMode.java b/src/appeng/api/config/ListMode.java new file mode 100644 index 00000000000..71bf93771c2 --- /dev/null +++ b/src/appeng/api/config/ListMode.java @@ -0,0 +1,18 @@ +package appeng.api.config; + + +public enum ListMode implements IConfigEnum { + + WHITELIST, BLACKLIST; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "ListMode"; + } + +} \ No newline at end of file diff --git a/src/appeng/api/config/MatchingMode.java b/src/appeng/api/config/MatchingMode.java new file mode 100644 index 00000000000..8ce433a8e1f --- /dev/null +++ b/src/appeng/api/config/MatchingMode.java @@ -0,0 +1,17 @@ +package appeng.api.config; + + +public enum MatchingMode implements IConfigEnum { + Fuzzy, + Precision; + + @Override + public IConfigEnum[] getValues() { + return MatchingMode.values(); + } + + @Override + public String getName() { + return "MatchingMode"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/OperationMode.java b/src/appeng/api/config/OperationMode.java new file mode 100644 index 00000000000..6a3f94e1d0c --- /dev/null +++ b/src/appeng/api/config/OperationMode.java @@ -0,0 +1,18 @@ +package appeng.api.config; + + +// do not change names.. +public enum OperationMode implements IConfigEnum { + Fill, + Empty; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "OperationMode"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/PowerUnits.java b/src/appeng/api/config/PowerUnits.java new file mode 100644 index 00000000000..7917050af08 --- /dev/null +++ b/src/appeng/api/config/PowerUnits.java @@ -0,0 +1,19 @@ +package appeng.api.config; + + +public enum PowerUnits implements IConfigEnum { + AE, + MJ, + EU, + UE; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "PowerUnits"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/RedstoneModeInput.java b/src/appeng/api/config/RedstoneModeInput.java new file mode 100644 index 00000000000..edbc51f921d --- /dev/null +++ b/src/appeng/api/config/RedstoneModeInput.java @@ -0,0 +1,20 @@ +package appeng.api.config; + + +// do not change names.. +public enum RedstoneModeInput implements IConfigEnum { + Ignore, + WhenOff, + WhenOn, + OnPulse; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "RedstoneMode"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/RedstoneModeInputOnOff.java b/src/appeng/api/config/RedstoneModeInputOnOff.java new file mode 100644 index 00000000000..e01cad66e2a --- /dev/null +++ b/src/appeng/api/config/RedstoneModeInputOnOff.java @@ -0,0 +1,19 @@ +package appeng.api.config; + + +// do not change names.. +public enum RedstoneModeInputOnOff implements IConfigEnum { + Ignore, + WhenOff, + WhenOn; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "RedstoneMode"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/RedstoneModeOutput.java b/src/appeng/api/config/RedstoneModeOutput.java new file mode 100644 index 00000000000..b94b116fbfa --- /dev/null +++ b/src/appeng/api/config/RedstoneModeOutput.java @@ -0,0 +1,18 @@ +package appeng.api.config; + + +// do not change names.. +public enum RedstoneModeOutput implements IConfigEnum { + WhenOff, + WhenOn; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "RedstoneMode"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/SearchBoxMode.java b/src/appeng/api/config/SearchBoxMode.java new file mode 100644 index 00000000000..7a99d1edb9e --- /dev/null +++ b/src/appeng/api/config/SearchBoxMode.java @@ -0,0 +1,22 @@ +package appeng.api.config; + +import net.minecraft.src.ModLoader; + +public enum SearchBoxMode implements IConfigEnum { + Autosearch, + Standard, + NEIAutoSearch, + NEIStandard; + + @Override + public IConfigEnum[] getValues() { + if ( ModLoader.isModLoaded( "NotEnoughItems" ) ) + return values(); + return new SearchBoxMode[]{ Autosearch, Standard }; + } + + @Override + public String getName() { + return "SearchBoxMode"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/SortDir.java b/src/appeng/api/config/SortDir.java new file mode 100644 index 00000000000..d09904e58f3 --- /dev/null +++ b/src/appeng/api/config/SortDir.java @@ -0,0 +1,18 @@ +package appeng.api.config; + + +public enum SortDir implements IConfigEnum +{ + ASC, + DESC; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "SortDir"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/SortOrder.java b/src/appeng/api/config/SortOrder.java new file mode 100644 index 00000000000..fc18c4a43e1 --- /dev/null +++ b/src/appeng/api/config/SortOrder.java @@ -0,0 +1,20 @@ +package appeng.api.config; + + +public enum SortOrder implements IConfigEnum +{ + Name, + Size, + Priority, + ItemID; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "SortOrder"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/StackModeInput.java b/src/appeng/api/config/StackModeInput.java new file mode 100644 index 00000000000..d99dda19871 --- /dev/null +++ b/src/appeng/api/config/StackModeInput.java @@ -0,0 +1,18 @@ +package appeng.api.config; + + +// do not change names.. +public enum StackModeInput implements IConfigEnum { + Single, + Stack; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "StackMode"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/StackModeOutput.java b/src/appeng/api/config/StackModeOutput.java new file mode 100644 index 00000000000..546b283a782 --- /dev/null +++ b/src/appeng/api/config/StackModeOutput.java @@ -0,0 +1,20 @@ +package appeng.api.config; + + +// do not change names.. +public enum StackModeOutput implements IConfigEnum { + Single, + Stack, + Craft, + CraftOnly; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "StackMode"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/TransferDir.java b/src/appeng/api/config/TransferDir.java new file mode 100644 index 00000000000..ed8cd4e1419 --- /dev/null +++ b/src/appeng/api/config/TransferDir.java @@ -0,0 +1,18 @@ +package appeng.api.config; + + +public enum TransferDir implements IConfigEnum +{ + LEFT, + RIGHT; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "TransferDir"; + } +} \ No newline at end of file diff --git a/src/appeng/api/config/ViewItems.java b/src/appeng/api/config/ViewItems.java new file mode 100644 index 00000000000..ec5c2d0f553 --- /dev/null +++ b/src/appeng/api/config/ViewItems.java @@ -0,0 +1,19 @@ +package appeng.api.config; + + +public enum ViewItems implements IConfigEnum +{ + ALL, + STORED, + CRAFTABLE; + + @Override + public IConfigEnum[] getValues() { + return values(); + } + + @Override + public String getName() { + return "ViewItems"; + } +} \ No newline at end of file diff --git a/src/appeng/api/events/AEWorldEvent.java b/src/appeng/api/events/AEWorldEvent.java new file mode 100644 index 00000000000..d4cb74b01ca --- /dev/null +++ b/src/appeng/api/events/AEWorldEvent.java @@ -0,0 +1,17 @@ +package appeng.api.events; + +import net.minecraft.world.World; +import net.minecraftforge.event.Event; + +/** + * Simple Alternative to WorldEvent, thanks to a certain mod that wants to crash on WorldEvents + */ +public class AEWorldEvent extends Event +{ + final public World world; + + public AEWorldEvent( World w ) + { + world = w; + } +} diff --git a/src/appeng/api/events/GridErrorEvent.java b/src/appeng/api/events/GridErrorEvent.java new file mode 100644 index 00000000000..748f1a6e70d --- /dev/null +++ b/src/appeng/api/events/GridErrorEvent.java @@ -0,0 +1,18 @@ +package appeng.api.events; + +import net.minecraft.world.World; +import net.minecraftforge.event.world.WorldEvent; +import appeng.api.WorldCoord; + +/** + * an error, basically just causes an update, use it if there is really an error, other wise just ignore it. + */ +public class GridErrorEvent extends AEWorldEvent { + + public WorldCoord coord; + public GridErrorEvent(World world, WorldCoord wc ) { + super(world); + coord = wc; + } + +} diff --git a/src/appeng/api/events/GridPatternUpdateEvent.java b/src/appeng/api/events/GridPatternUpdateEvent.java new file mode 100644 index 00000000000..413b13e96dc --- /dev/null +++ b/src/appeng/api/events/GridPatternUpdateEvent.java @@ -0,0 +1,22 @@ +package appeng.api.events; + +import net.minecraft.world.World; +import net.minecraftforge.event.world.WorldEvent; +import appeng.api.WorldCoord; +import appeng.api.me.util.IGridInterface; + +/** + * Posted when crafting options in a AE Network update, you can watch for them if you want to. + */ +public class GridPatternUpdateEvent extends AEWorldEvent { + + final public WorldCoord coord; + final public IGridInterface grid; + + public GridPatternUpdateEvent(World world, WorldCoord wc, IGridInterface gi ) { + super(world); + grid = gi; + coord = wc; + } + +} diff --git a/src/appeng/api/events/GridStorageUpdateEvent.java b/src/appeng/api/events/GridStorageUpdateEvent.java new file mode 100644 index 00000000000..aab73c426db --- /dev/null +++ b/src/appeng/api/events/GridStorageUpdateEvent.java @@ -0,0 +1,22 @@ +package appeng.api.events; + +import net.minecraft.world.World; +import net.minecraftforge.event.world.WorldEvent; +import appeng.api.WorldCoord; +import appeng.api.me.util.IGridInterface; + +/** + * Posted when storage options in a AE Network update, such as a new Storage Bus or Cell is added, or removed. + */ +public class GridStorageUpdateEvent extends AEWorldEvent { + + final public WorldCoord coord; + final public IGridInterface grid; + + public GridStorageUpdateEvent(World world, WorldCoord wc, IGridInterface gi ) { + super(world); + grid = gi; + coord = wc; + } + +} diff --git a/src/appeng/api/events/GridTileConnectivityEvent.java b/src/appeng/api/events/GridTileConnectivityEvent.java new file mode 100644 index 00000000000..9d793899ab3 --- /dev/null +++ b/src/appeng/api/events/GridTileConnectivityEvent.java @@ -0,0 +1,22 @@ +package appeng.api.events; + +import net.minecraft.world.World; +import net.minecraftforge.event.world.WorldEvent; +import appeng.api.WorldCoord; +import appeng.api.me.tiles.IGridTileEntity; + +/** + * The network has changed, and must be updated. + */ +public class GridTileConnectivityEvent extends AEWorldEvent { + + public WorldCoord coord; + public IGridTileEntity te; + + public GridTileConnectivityEvent( IGridTileEntity _te, World world, WorldCoord wc ) { + super(world); + te = _te; + coord = wc; + } + +} diff --git a/src/appeng/api/events/GridTileLoadEvent.java b/src/appeng/api/events/GridTileLoadEvent.java new file mode 100644 index 00000000000..2293f56afc7 --- /dev/null +++ b/src/appeng/api/events/GridTileLoadEvent.java @@ -0,0 +1,22 @@ +package appeng.api.events; + +import net.minecraft.world.World; +import net.minecraftforge.event.world.WorldEvent; +import appeng.api.WorldCoord; +import appeng.api.me.tiles.IGridTileEntity; + +/** + * A Tile has been added to the world, and should be evaluated for Network Connectivity. + */ +public class GridTileLoadEvent extends AEWorldEvent { + + public WorldCoord coord; + public IGridTileEntity te; + + public GridTileLoadEvent(IGridTileEntity _te, World world, WorldCoord wc ) { + super(world); + te = _te; + coord = wc; + } + +} diff --git a/src/appeng/api/events/GridTileUnloadEvent.java b/src/appeng/api/events/GridTileUnloadEvent.java new file mode 100644 index 00000000000..d96ccefb2ef --- /dev/null +++ b/src/appeng/api/events/GridTileUnloadEvent.java @@ -0,0 +1,22 @@ +package appeng.api.events; + +import net.minecraft.world.World; +import net.minecraftforge.event.world.WorldEvent; +import appeng.api.WorldCoord; +import appeng.api.me.tiles.IGridTileEntity; + +/** + * A Tile has been removed from the world, and should no longer be considered for connectivity. + */ +public class GridTileUnloadEvent extends AEWorldEvent { + + public WorldCoord coord; + public IGridTileEntity te; + + public GridTileUnloadEvent(IGridTileEntity _te,World world, WorldCoord wc ) { + super(world); + te = _te; + coord = wc; + } + +} diff --git a/src/appeng/api/events/LocateableEventAnnounce.java b/src/appeng/api/events/LocateableEventAnnounce.java new file mode 100644 index 00000000000..2605629ebef --- /dev/null +++ b/src/appeng/api/events/LocateableEventAnnounce.java @@ -0,0 +1,25 @@ +package appeng.api.events; + +import net.minecraftforge.event.Event; +import appeng.api.me.tiles.ILocateable; + +/** + * Used to Notify the Location Registry of objects, and their availability. + */ +public class LocateableEventAnnounce extends Event { + + public enum LocateableEvent { + Register, // Adds the locateable to the registry + Unregister // Removes the Locatable from the registry + }; + + final public ILocateable target; + final public LocateableEvent change; + + public LocateableEventAnnounce( ILocateable o, LocateableEvent ev ) + { + target = o; + change = ev; + } + +} diff --git a/src/appeng/api/events/MultiBlockUpdateEvent.java b/src/appeng/api/events/MultiBlockUpdateEvent.java new file mode 100644 index 00000000000..280abddd27d --- /dev/null +++ b/src/appeng/api/events/MultiBlockUpdateEvent.java @@ -0,0 +1,22 @@ +package appeng.api.events; + +import net.minecraft.world.World; +import net.minecraftforge.event.world.WorldEvent; +import appeng.api.WorldCoord; +import appeng.api.me.tiles.IGridTileEntity; + +/** + * Used by the MAC to trigger updates in its structure. + */ +public class MultiBlockUpdateEvent extends AEWorldEvent { + + public WorldCoord coord; + public IGridTileEntity te; + + public MultiBlockUpdateEvent( IGridTileEntity _te, World world, WorldCoord wc ) { + super(world); + coord = wc; + te = _te; + } + +} diff --git a/src/appeng/api/exceptions/AppEngException.java b/src/appeng/api/exceptions/AppEngException.java new file mode 100644 index 00000000000..940e7beefd6 --- /dev/null +++ b/src/appeng/api/exceptions/AppEngException.java @@ -0,0 +1,12 @@ +package appeng.api.exceptions; + +public class AppEngException extends Exception +{ + + private static final long serialVersionUID = -9051434206368465494L; + + public AppEngException(String t) + { + super(t); + } +} diff --git a/src/appeng/api/exceptions/AppEngTileMissingException.java b/src/appeng/api/exceptions/AppEngTileMissingException.java new file mode 100644 index 00000000000..067e47f1a76 --- /dev/null +++ b/src/appeng/api/exceptions/AppEngTileMissingException.java @@ -0,0 +1,30 @@ +package appeng.api.exceptions; + +import cpw.mods.fml.common.FMLLog; +import net.minecraft.world.World; +import appeng.api.DimentionalCoord; + +public class AppEngTileMissingException extends Exception { + + private static final long serialVersionUID = -3502227742711078681L; + public DimentionalCoord dc; + + @Override + public void printStackTrace() { + try + { + FMLLog.info( "[AppEng] Missing Tile at "+dc.x+", "+dc.y+", "+dc.z+" in +"+dc.getWorld().getWorldInfo().getVanillaDimension() ); + } + catch( Throwable _ ) + { + FMLLog.info( "[AppEng] Missing Tile at "+dc.x+", "+dc.y+", "+dc.z ); + } + super.printStackTrace(); + } + + public AppEngTileMissingException(World w, int x, int y, int z) + { + dc = new DimentionalCoord( w, x, y, z ); + } + +} diff --git a/src/appeng/api/me/items/IAEChargeableItem.java b/src/appeng/api/me/items/IAEChargeableItem.java new file mode 100644 index 00000000000..8619a8b708d --- /dev/null +++ b/src/appeng/api/me/items/IAEChargeableItem.java @@ -0,0 +1,25 @@ + +package appeng.api.me.items; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +/* + * A simple AE interface used internally for PowerRelay charging. + */ +public interface IAEChargeableItem { + + /* + * Return the amount of energy not used. + * + * if you return the same amount out, as was passed in, then it will consider charging done. + * + */ + public float addEnergy( ItemStack target, float energy ); + + /* + * Must return true for the target item for it to be considered a charageable item. + */ + public boolean isChargeable( ItemStack it ); + +} diff --git a/src/appeng/api/me/items/IAEWrench.java b/src/appeng/api/me/items/IAEWrench.java new file mode 100644 index 00000000000..6abead7b41e --- /dev/null +++ b/src/appeng/api/me/items/IAEWrench.java @@ -0,0 +1,9 @@ +package appeng.api.me.items; + +import net.minecraft.entity.player.EntityPlayer; + +public interface IAEWrench { + + boolean canWrench(EntityPlayer player, int x, int y, int z); + +} diff --git a/src/appeng/api/me/items/IAssemblerPatternItem.java b/src/appeng/api/me/items/IAssemblerPatternItem.java new file mode 100644 index 00000000000..42532da9a39 --- /dev/null +++ b/src/appeng/api/me/items/IAssemblerPatternItem.java @@ -0,0 +1,8 @@ +package appeng.api.me.items; + +/** + * Like ILocationPatternItem, not really useful... + */ +public interface IAssemblerPatternItem +{ +} diff --git a/src/appeng/api/me/items/ILocationPatternItem.java b/src/appeng/api/me/items/ILocationPatternItem.java new file mode 100644 index 00000000000..58a0bd4a065 --- /dev/null +++ b/src/appeng/api/me/items/ILocationPatternItem.java @@ -0,0 +1,7 @@ +package appeng.api.me.items; + +/** + * Like IAssemblerPatternItem, not really useful... + */ +public interface ILocationPatternItem { +} diff --git a/src/appeng/api/me/items/IMEPatternItem.java b/src/appeng/api/me/items/IMEPatternItem.java new file mode 100644 index 00000000000..d9458709842 --- /dev/null +++ b/src/appeng/api/me/items/IMEPatternItem.java @@ -0,0 +1,9 @@ +package appeng.api.me.items; + +/** + * Some basic actions you can perform on Patterns. + */ +public interface IMEPatternItem { + boolean isEncoded(); + String Type(); +} diff --git a/src/appeng/api/me/items/IMemoryCard.java b/src/appeng/api/me/items/IMemoryCard.java new file mode 100644 index 00000000000..f9c1df53492 --- /dev/null +++ b/src/appeng/api/me/items/IMemoryCard.java @@ -0,0 +1,40 @@ +package appeng.api.me.items; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +/** + * used to interact with memory card items. + */ +public interface IMemoryCard { + + /** + * returns true if the item is in fact a memory card. + * @param is + * @return + */ + boolean isMemoryCard( ItemStack is ); + + /** + * Configures the data stored on the memory card, the SettingsName, will be localized when displayed. + * @param is + * @param SettingsName + * @param data + */ + void setMemoryCardContents( ItemStack is, String SettingsName, NBTTagCompound data ); + + /** + * returns the settings name provided previously by setMemoryCardContents, or "AppEng.GuiITooltip.Blank" if there is no settings. + * @param is + * @return + */ + String getSettingsName( ItemStack is ); + + /** + * returns the NBT Data previously saved by setMemoryCardContents, or an empty NBTCompound + * @param is + * @return + */ + NBTTagCompound getData( ItemStack is ); + +} diff --git a/src/appeng/api/me/items/IStorageCell.java b/src/appeng/api/me/items/IStorageCell.java new file mode 100644 index 00000000000..d77580d8906 --- /dev/null +++ b/src/appeng/api/me/items/IStorageCell.java @@ -0,0 +1,48 @@ +package appeng.api.me.items; + +import appeng.api.IAEItemStack; +import net.minecraft.item.ItemStack; + +/** + * Any item which implements this can be treated as an IMEInventory via Util.getCell / Util.isCell + * It automatically handles the internals and NBT data, which is both nice, and bad for you! + */ +public interface IStorageCell +{ + /** + * rv0 - If this returns something where N % 8 != 0 Then you will be shot on sight, or your car will explode, something like that least... + * @param cellItem + * @return numberofBytes + */ + int getBytes( ItemStack cellItem ); + + /** + * rv0 - Determines the number of bytes used for any type included on the cell. + * @param cellItem + * @return numberOfBytes + */ + int BytePerType( ItemStack iscellItem ); + + /** + * rv11 - Must be between 1 and 63, indicates how many types you want to store on the item. + * @param cellItem + * @return numberOfTypes + */ + int getTotalTypes( ItemStack cellItem ); + + /** + * rv11 - allows you to fine tune which items are allowed on a given cell, + * if you don't care, just return false; + * As the handler for this type of cell is still the default cells, the normal AE black list is also applied. + * @param cellItem + * @param requsetedAddition + * @return preventAdditionOfItem + */ + boolean isBlackListed( ItemStack cellItem, IAEItemStack requsetedAddition ); + + /** + * rv11 - allows you to specify if this storage cell can be stored inside other storage cells, only set this for special items like the matter cannon that are not general purpose storage. + * @return + */ + boolean storableInStorageCell(); +} diff --git a/src/appeng/api/me/items/IStorageComponent.java b/src/appeng/api/me/items/IStorageComponent.java new file mode 100644 index 00000000000..f905373fe07 --- /dev/null +++ b/src/appeng/api/me/items/IStorageComponent.java @@ -0,0 +1,21 @@ +package appeng.api.me.items; + +import net.minecraft.item.ItemStack; + +public interface IStorageComponent { + + /** + * rv11 - This isn't necessarily the same as if you make a storage cell out of it, but all of AE's default cells do it that way, its currently only used for the condenser. + * @param cellItem + * @return numberofBytes + */ + int getBytes( ItemStack is ); + + /** + * rv11 - just true or false for the item stack. + * @param is + * @return + */ + boolean isStorageComponent( ItemStack is ); + +} diff --git a/src/appeng/api/me/tiles/IAssemblerMB.java b/src/appeng/api/me/tiles/IAssemblerMB.java new file mode 100644 index 00000000000..9b7cf72aede --- /dev/null +++ b/src/appeng/api/me/tiles/IAssemblerMB.java @@ -0,0 +1,20 @@ +package appeng.api.me.tiles; + +import appeng.api.WorldCoord; +import appeng.api.me.util.IAssemblerCluster; + +public interface IAssemblerMB { + + /** + * Do this: + * return new WorldCoord( TileEntity.xCoord, TileEntity.yCoord, TileEntity.zCoord ); + */ + public WorldCoord getLocation(); + public IAssemblerCluster getCluster(); + public void updateStatus( IAssemblerCluster ac ); + public boolean isComplete(); + + void calculateMultiblock( long instanceCalc ); + public long markViewed(long inst); + +} diff --git a/src/appeng/api/me/tiles/IAssemblerPatternProvider.java b/src/appeng/api/me/tiles/IAssemblerPatternProvider.java new file mode 100644 index 00000000000..b59f0b2315e --- /dev/null +++ b/src/appeng/api/me/tiles/IAssemblerPatternProvider.java @@ -0,0 +1,11 @@ +package appeng.api.me.tiles; + +import appeng.api.me.util.IAssemblerPattern; + +/** + * Both useless and incredibly useful, maybe... + */ +public interface IAssemblerPatternProvider +{ + public IAssemblerPattern provideAssemblerPattern(); +} diff --git a/src/appeng/api/me/tiles/ICellContainer.java b/src/appeng/api/me/tiles/ICellContainer.java new file mode 100644 index 00000000000..40481a5eed7 --- /dev/null +++ b/src/appeng/api/me/tiles/ICellContainer.java @@ -0,0 +1,24 @@ +package appeng.api.me.tiles; + +import java.util.List; + +import appeng.api.me.util.IMEInventoryHandler; + +/** + * Represents a tile that contributes to storage, such as a ME Chest, or ME Drive. + * + * Remember to trigger the appropriate storage update vents, when your getCellArray Changes. * + */ +public interface ICellContainer { + + /** + * Inventory of the tile for use with ME, should always return an valid list, never NULL. + */ + List getCellArray(); + + /** + * the storage's priority. + */ + int getPriority(); + +} diff --git a/src/appeng/api/me/tiles/ICellProvider.java b/src/appeng/api/me/tiles/ICellProvider.java new file mode 100644 index 00000000000..e65d09ad634 --- /dev/null +++ b/src/appeng/api/me/tiles/ICellProvider.java @@ -0,0 +1,23 @@ +package appeng.api.me.tiles; + +import appeng.api.me.util.IMEInventoryHandler; + +/** + * Both useless and incredibly useful, maybe... + */ +public interface ICellProvider +{ + /** + * consume power to add an item to the storage system. + * @param items + * @param multiplier + * @return + */ + public int usePowerForAddition( int items, int multiplier ); + + /** + * returns a ME Inventory for interaction. + */ + public IMEInventoryHandler provideCell(); + +} diff --git a/src/appeng/api/me/tiles/IColoredMETile.java b/src/appeng/api/me/tiles/IColoredMETile.java new file mode 100644 index 00000000000..70a61cf9b76 --- /dev/null +++ b/src/appeng/api/me/tiles/IColoredMETile.java @@ -0,0 +1,36 @@ +package appeng.api.me.tiles; + +/** + * Used to signify which color a particular IGridTileEntity or IGridMachine is, you must implement both, if you wish to have color bias. + */ +public interface IColoredMETile +{ + public static String[] Colors = { + "Blue", + "Black", + "White", + "Brown", + "Red", + "Yellow", + "Green" + }; + + /** + * return true, if your block has a color, or false, if it dosn't. + * this allows you to have a colored block that can pretend to be colorless. + * @return true, if colored, false if not. + */ + boolean isColored(); + + /** + * Change the color, AE dosn't call this except for its own blocks, its simply included for completeness. + * @param offset + */ + void setColor( int offset ); + + /** + * which color is this tile? + * @return index into the above ColorsList. + */ + int getColor(); +} diff --git a/src/appeng/api/me/tiles/IConfigureableTile.java b/src/appeng/api/me/tiles/IConfigureableTile.java new file mode 100644 index 00000000000..fbaa38de17d --- /dev/null +++ b/src/appeng/api/me/tiles/IConfigureableTile.java @@ -0,0 +1,28 @@ +package appeng.api.me.tiles; + +import java.util.List; + +/** + * Some ME Tiles can be configured, generally via interface, but these let you do this programatically. + */ +public interface IConfigureableTile { + + /** Switches configuration to next option... ( returns new configuration. ) */ + String prevConfiguration(String name); + + /** Switches configuration to next option... ( returns new configuration. ) */ + String nextConfiguration(String name); + + /** Gets a list off all the configurations... */ + List getConfigurations(); + + /** Gets the options of a particular configuration. */ + List getConfiguationOptions( String name ); + + /** Set a configuration to a specific option... ( returns the old one. ) */ + String setConfiguration(String name, String value); + + /** The the current value for a configuration. */ + String getConfiguration(String name); + +} diff --git a/src/appeng/api/me/tiles/IConnectionSensitive.java b/src/appeng/api/me/tiles/IConnectionSensitive.java new file mode 100644 index 00000000000..723401c1f31 --- /dev/null +++ b/src/appeng/api/me/tiles/IConnectionSensitive.java @@ -0,0 +1,11 @@ +package appeng.api.me.tiles; + +import java.util.Set; + +import net.minecraftforge.common.ForgeDirection; + +public interface IConnectionSensitive { + + void onMEConnectionsChanged( Set connections, Set visualConnections ); + +} diff --git a/src/appeng/api/me/tiles/IDirectionalMETile.java b/src/appeng/api/me/tiles/IDirectionalMETile.java new file mode 100644 index 00000000000..1cccdc63378 --- /dev/null +++ b/src/appeng/api/me/tiles/IDirectionalMETile.java @@ -0,0 +1,20 @@ +package appeng.api.me.tiles; + +import net.minecraftforge.common.ForgeDirection; + +/** + * Used to signify which directions a particular IGridTileEntity or IGridMachine can connect to/from, + * you must implement both, if you wish to have this functionality. + * + * Example Buses, that do not conenct in the direction of the bus. + */ +public interface IDirectionalMETile +{ + + /** + * return true if this tile can connect in a specific direction. + * @param dir + * @return true, if it can connect. + */ + boolean canConnect( ForgeDirection dir ); +} diff --git a/src/appeng/api/me/tiles/IExtendedCellProvider.java b/src/appeng/api/me/tiles/IExtendedCellProvider.java new file mode 100644 index 00000000000..5df4532b98e --- /dev/null +++ b/src/appeng/api/me/tiles/IExtendedCellProvider.java @@ -0,0 +1,13 @@ +package appeng.api.me.tiles; + +import appeng.api.me.util.IMEInventoryHandler; + +/** + * Both useless and incredibly useful, maybe... + */ +public interface IExtendedCellProvider extends ICellProvider +{ + + public IMEInventoryHandler provideCell( String Filter ); + +} diff --git a/src/appeng/api/me/tiles/IFulllyOptionalMETile.java b/src/appeng/api/me/tiles/IFulllyOptionalMETile.java new file mode 100644 index 00000000000..664bd228221 --- /dev/null +++ b/src/appeng/api/me/tiles/IFulllyOptionalMETile.java @@ -0,0 +1,11 @@ +package appeng.api.me.tiles; + +/** + * Cables will disconnect if its not enabled, + * this means that they will fail to appear connected, example - MAC + */ +public interface IFulllyOptionalMETile extends IOptionalMETile { + + boolean isSeperated(); + +} diff --git a/src/appeng/api/me/tiles/IGridMachine.java b/src/appeng/api/me/tiles/IGridMachine.java new file mode 100644 index 00000000000..c62d3a69735 --- /dev/null +++ b/src/appeng/api/me/tiles/IGridMachine.java @@ -0,0 +1,13 @@ +package appeng.api.me.tiles; + +/** + * Allows you to drain energy via ME Cables, if you only care if the grid is powered you only need IGridTileEntity. + */ +public abstract interface IGridMachine extends IGridTileEntity +{ + /** + * how much power this entity drains to run constantly. + */ + public abstract float getPowerDrainPerTick(); + +} diff --git a/src/appeng/api/me/tiles/IGridTeleport.java b/src/appeng/api/me/tiles/IGridTeleport.java new file mode 100644 index 00000000000..6703b4e19d3 --- /dev/null +++ b/src/appeng/api/me/tiles/IGridTeleport.java @@ -0,0 +1,11 @@ +package appeng.api.me.tiles; + +import appeng.api.DimentionalCoord; + +/** + * Create a connection to a normally not connected tile + */ +public interface IGridTeleport +{ + DimentionalCoord[] findRemoteSide(); +} diff --git a/src/appeng/api/me/tiles/IGridTileEntity.java b/src/appeng/api/me/tiles/IGridTileEntity.java new file mode 100644 index 00000000000..7b956302063 --- /dev/null +++ b/src/appeng/api/me/tiles/IGridTileEntity.java @@ -0,0 +1,49 @@ +package appeng.api.me.tiles; + +import net.minecraft.world.World; +import appeng.api.WorldCoord; +import appeng.api.me.util.IGridInterface; + +/** + * Basic ME Grid Interface, informs you of the Grid power status, and other details. + */ +public abstract interface IGridTileEntity +{ + /** + * Do this: + * return new WorldCoord( TileEntity.xCoord, TileEntity.yCoord, TileEntity.zCoord ); + */ + public abstract WorldCoord getLocation(); + + /** + * If your tile entity is valid return true. + */ + public boolean isValid(); + + /** + * Informs you of either true or false. + * if the power feed has stopped, or been continued, only called when changes happens, or when grid updates happen. + */ + public abstract void setPowerStatus(boolean hasPower); + + /** + * Yes if the device has a powered status. + */ + public abstract boolean isPowered(); + + /** + * Return your last grid you got via setGrid. + */ + public IGridInterface getGrid(); + + /** + * Informs you of your new grid, YOU MUST return this via getGrid. + * Store for later. + */ + public void setGrid(IGridInterface gi); + + /** + * Return worldObj + */ + public World getWorld(); +} diff --git a/src/appeng/api/me/tiles/ILocateable.java b/src/appeng/api/me/tiles/ILocateable.java new file mode 100644 index 00000000000..18417876aab --- /dev/null +++ b/src/appeng/api/me/tiles/ILocateable.java @@ -0,0 +1,10 @@ +package appeng.api.me.tiles; + +public interface ILocateable +{ + /** + * returns the serial for a locateable object. + * @return + */ + long getLocatableSerial(); +} diff --git a/src/appeng/api/me/tiles/IMEPowerStorage.java b/src/appeng/api/me/tiles/IMEPowerStorage.java new file mode 100644 index 00000000000..5a118407fcd --- /dev/null +++ b/src/appeng/api/me/tiles/IMEPowerStorage.java @@ -0,0 +1,34 @@ +package appeng.api.me.tiles; + +/** + * Used to access information about AE's various power accepting blocks for monitoring purposes. + * + */ +public interface IMEPowerStorage { + + /** + * ME power storage asset, pass the amount you want to use, and what you want to use it for. + * @param use + * @param for_what + * @return if you can use it. + */ + boolean useMEEnergy( float use, String for_what ); + + /** + * Add energy to an ME Power storage. + * @param amt that was not added to storage myEnergy = addMEPower( myEnergy ); // pushes your power into the network. + * @return + */ + public double addMEPower( double amt ); + + /** + * returns the current maximum power ( this can change :P ) + */ + public double getMEMaxPower(); + + /** + * returns the current AE Power Level, this may exceed getMEMaxPower() + */ + public double getMECurrentPower(); + +} diff --git a/src/appeng/api/me/tiles/INonSignalBlock.java b/src/appeng/api/me/tiles/INonSignalBlock.java new file mode 100644 index 00000000000..eb0fb801918 --- /dev/null +++ b/src/appeng/api/me/tiles/INonSignalBlock.java @@ -0,0 +1,9 @@ +package appeng.api.me.tiles; + +/** + * By simply implenting this, the networks can be become aware of a block they touch, but they don't propogate signal or really belong to a network. + * Not sure what it would be used for to be honest beyond the power relay. + */ +public interface INonSignalBlock { + +} diff --git a/src/appeng/api/me/tiles/IOptionalMETile.java b/src/appeng/api/me/tiles/IOptionalMETile.java new file mode 100644 index 00000000000..ff0d525d4cc --- /dev/null +++ b/src/appeng/api/me/tiles/IOptionalMETile.java @@ -0,0 +1,14 @@ +package appeng.api.me.tiles; + +/** + * Cables will connect, but signal will not propagate. ( IFulllyOptionalMETile disconnects ) + */ +public interface IOptionalMETile { + + /** + * if false, the signal will not propigate via this tile, remember to use connectivity events. + * @return + */ + public boolean isEnabled(); + +} diff --git a/src/appeng/api/me/tiles/IOrientableTile.java b/src/appeng/api/me/tiles/IOrientableTile.java new file mode 100644 index 00000000000..263367366b2 --- /dev/null +++ b/src/appeng/api/me/tiles/IOrientableTile.java @@ -0,0 +1,26 @@ +package appeng.api.me.tiles; + +import net.minecraftforge.common.ForgeDirection; + +/** + * Please note that none of these methods will cause a block update, + * if you use set ori/spin/cycle, must mark the block for update if it was already sent to the client. + */ +public interface IOrientableTile { + + // returns the main direction for rotation. + ForgeDirection getPrimaryOrientation(); + + // used for up or down orientation to spin the tile around, 0 - 3 clockwise ( probobly ) + int getSpin(); + + // returns the main direction for rotation. + void setPrimaryOrientation( ForgeDirection s ); + + // used for up or down orientation. + void setSpin( int spin ); + + // acts like a wrench was used on it, if a wrench does nothing, this does nothing. + void cycleOrientation(); + +} diff --git a/src/appeng/api/me/tiles/IPriorityTile.java b/src/appeng/api/me/tiles/IPriorityTile.java new file mode 100644 index 00000000000..b4243a3fc0e --- /dev/null +++ b/src/appeng/api/me/tiles/IPriorityTile.java @@ -0,0 +1,17 @@ +package appeng.api.me.tiles; + +public interface IPriorityTile +{ + /** + * gets the current priroity, can be negitive or positive. + * implemented by storage systems, and is used for sorting. + * @return + */ + int getPriority(); + + /** + * change the priority. + * @param p + */ + void setPriority( int p ); +} diff --git a/src/appeng/api/me/tiles/IPushable.java b/src/appeng/api/me/tiles/IPushable.java new file mode 100644 index 00000000000..f96b6205e95 --- /dev/null +++ b/src/appeng/api/me/tiles/IPushable.java @@ -0,0 +1,30 @@ +package appeng.api.me.tiles; + +import net.minecraft.item.ItemStack; + +/** + * An IPushable should return what dosn't fit, so that the crafting request cannot complete, + * stalling the action and saving your resources. + */ +public interface IPushable +{ + /** + * is this pushable busy? + * @return + */ + boolean isBusy(); + + /** + * Attempt to send an item. + * @param out + * @return + */ + ItemStack pushItem( ItemStack out ); + + /** + * Test if a push is possible. + * @param out + * @return + */ + boolean canPushItem(ItemStack out); +} diff --git a/src/appeng/api/me/tiles/IStorageAware.java b/src/appeng/api/me/tiles/IStorageAware.java new file mode 100644 index 00000000000..c064da5ec37 --- /dev/null +++ b/src/appeng/api/me/tiles/IStorageAware.java @@ -0,0 +1,13 @@ +package appeng.api.me.tiles; + +import appeng.api.IItemList; + +public interface IStorageAware { + + /** + * if your GridTile Implements this interface, the Network will notify it of changes, and send you a list of the contents so you can updates statues, WAY BETTER then polling. + * @param iss + */ + void onNetworkInventoryChange( IItemList iss ); + +} diff --git a/src/appeng/api/me/tiles/IStorageMonitor.java b/src/appeng/api/me/tiles/IStorageMonitor.java new file mode 100644 index 00000000000..f8886b1076a --- /dev/null +++ b/src/appeng/api/me/tiles/IStorageMonitor.java @@ -0,0 +1,20 @@ +package appeng.api.me.tiles; + +import appeng.api.IAEItemStack; + +public interface IStorageMonitor { + + /** + * Get the item being displayed on the storage monitor, in AEItemstack Form, you can use that to get the equivalent MC ItemStack, if you need it. + * If the quantity is important remember to use getStackSize() on the IAEItemStack,and not ItemStack.stackSize + * @return + */ + IAEItemStack getItem(); + + /** + * Get the current locked state of the access terminal. + * @return + */ + boolean isLocked(); + +} diff --git a/src/appeng/api/me/tiles/ITileCable.java b/src/appeng/api/me/tiles/ITileCable.java new file mode 100644 index 00000000000..ed64d54d4a0 --- /dev/null +++ b/src/appeng/api/me/tiles/ITileCable.java @@ -0,0 +1,7 @@ +package appeng.api.me.tiles; + +public interface ITileCable { + + public boolean coveredConnections(); + +} diff --git a/src/appeng/api/me/tiles/ITileIOCable.java b/src/appeng/api/me/tiles/ITileIOCable.java new file mode 100644 index 00000000000..d63dd2beb44 --- /dev/null +++ b/src/appeng/api/me/tiles/ITileIOCable.java @@ -0,0 +1,30 @@ +package appeng.api.me.tiles; + +import net.minecraft.inventory.IInventory; + +/** + * used to allow you to inspect, and configure a Export / Import / Storage Bus + * Export and Import buses also implement IConfigureableTile, which may be of interest. + */ +public interface ITileIOCable { + + public enum Version { + Basic, Precision, Fuzzy + }; + + /** + * returns one of the above, to indicate which version of the bus it is. + */ + Version getVersion(); + + /** + * Returns an IInventory that represents the configuration. + */ + IInventory getConfiguration(); + + /** + * Returns the name of the bus.. + */ + String getName(); + +} diff --git a/src/appeng/api/me/tiles/ITileInterfaceApi.java b/src/appeng/api/me/tiles/ITileInterfaceApi.java new file mode 100644 index 00000000000..f4a2855b2ec --- /dev/null +++ b/src/appeng/api/me/tiles/ITileInterfaceApi.java @@ -0,0 +1,78 @@ +package appeng.api.me.tiles; + +import java.util.List; + +import net.minecraft.item.ItemStack; +import appeng.api.me.util.IMEInventory; +import appeng.api.me.util.InterfaceCraftingResponse; + +/** + * Implemented by the ME Interface + * give direct access to some more complicated logic, in a simpler way, was used for earily LP integration. + */ +public interface ITileInterfaceApi { + + /** + * how much space is available. + * @param i + * @param MaxNeeded, a cut off where you stop caring + * @return totalAmountNeeded + */ + int apiCurrentAvailableSpace(ItemStack i, int MaxNeeded); + + /** + * Attempt to extract an item from the network. + * @param i, item to extract. + * @param doExtract, if you don't its just a simulation. + * @return anyExtracted Items, or null + */ + ItemStack apiExtractNetworkItem(ItemStack i, boolean doExtract); + + /** + * Adds an item to the network + * @param i + * @param doAdd, or simulate + * @return any items that couldn't be added, or nul + */ + ItemStack apiAddNetworkItem(ItemStack i, boolean doAdd); + + /** + * returns a list of ItemStacks that are contined in the network. + * @return + */ + List apiGetNetworkContents(); + + /** + * get access to the networks IMEInventory. + * @return + */ + IMEInventory getApiArray(); + + /** + * get a list of items that can be crafted by the network. + * @return + */ + List getCraftingOptions(); + + /** + * get access to the crafting patterns. + * @param req + * @return + */ + List findCraftingPatterns( ItemStack req ); + + /** + * issue a new crafting request. + * @param req + * @param enableRecursive + * @return + */ + InterfaceCraftingResponse requestCrafting( ItemStack req, boolean enableRecursive ); + + /** + * if there is anything at all available it returns true. + * @return + */ + boolean containsItems(); + +} diff --git a/src/appeng/api/me/tiles/InterfaceCraftingPattern.java b/src/appeng/api/me/tiles/InterfaceCraftingPattern.java new file mode 100644 index 00000000000..3ba69b43269 --- /dev/null +++ b/src/appeng/api/me/tiles/InterfaceCraftingPattern.java @@ -0,0 +1,19 @@ +package appeng.api.me.tiles; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +public class InterfaceCraftingPattern { + + /** + * list of all the inputs. + */ + public List Inputs; + + /** + * the output of the pattern. + */ + public ItemStack Output; + +} diff --git a/src/appeng/api/me/util/Grid.java b/src/appeng/api/me/util/Grid.java new file mode 100644 index 00000000000..74a81349291 --- /dev/null +++ b/src/appeng/api/me/util/Grid.java @@ -0,0 +1,84 @@ +package appeng.api.me.util; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import appeng.api.me.tiles.IGridTileEntity; + +/** + * ME Network, aka Grid related features and functionality. + */ +public class Grid +{ + /** + * Attempts to find a grid interface for the specified location. + * @param w + * @param x + * @param y + * @param z + * @return interfaceForGrid + */ + public static IGridInterface getGridInterface(World w, int x, int y, int z) + { + IGridTileEntity te = getGridEntity(w, x, y, z); + + if (te != null) + { + return te.getGrid(); + } + + return null; + } + + /** + * Simple test to see if the tile at the specified location is in fact a grid entity. + * @param w + * @param x + * @param y + * @param z + * @return isTileGridEntity + */ + public static boolean isGridEntity(World w, int x, int y, int z) + { + return getGridEntity(w, x, y, z) != null; + } + + /** + * Returns the grid entity at the given location, or null if its not a grid entity. + * @param w + * @param x + * @param y + * @param z + * @return gridEntity + */ + public static IGridTileEntity getGridEntity(World w, int x, int y, int z) + { + TileEntity te = w.getBlockTileEntity(x, y, z); + + if (te instanceof IGridTileEntity) + { + return (IGridTileEntity)te; + } + + return null; + } + + /** + * Tests if the given grid entity is on a Network. + * @param w + * @param x + * @param y + * @param z + * @return isOnNetwork + */ + public static boolean isOnGrid(World w, int x, int y, int z) + { + IGridTileEntity te = getGridEntity(w, x, y, z); + + if (te != null) + { + return te.getGrid() != null; + } + + return false; + } +} diff --git a/src/appeng/api/me/util/IAssemblerCluster.java b/src/appeng/api/me/util/IAssemblerCluster.java new file mode 100644 index 00000000000..39902290b36 --- /dev/null +++ b/src/appeng/api/me/util/IAssemblerCluster.java @@ -0,0 +1,37 @@ +package appeng.api.me.util; + +import net.minecraft.tileentity.TileEntity; + +/** + * Definition for a MAC + * + */ +public interface IAssemblerCluster { + + /** + * cycles the cpus, should be called once a tick, if called more, crafting will accelerate. + */ + public void cycleCpus(); + + /** + * Tells the MAC one of the cpus was used. + */ + void addCraft(); + + /** + * is there a CPU available for Crafting? + * @return hasCPUReady + */ + boolean canCraft(); + + /** + * Gets a TileAssembler from the MAC + * @param assemblerOffset + * @return TileEntity for that Assembler or Null + */ + TileEntity getAssembler( int assemblerOffset ); + + public int getLastOffset(); + + public void setLastOffset( int x ); +} diff --git a/src/appeng/api/me/util/IAssemblerPattern.java b/src/appeng/api/me/util/IAssemblerPattern.java new file mode 100644 index 00000000000..56e1a098e4a --- /dev/null +++ b/src/appeng/api/me/util/IAssemblerPattern.java @@ -0,0 +1,78 @@ +package appeng.api.me.util; + +import java.util.List; + +import appeng.api.IItemList; +import appeng.api.me.tiles.IPushable; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +/** + * Interact with the internals of assembler patterns, get this via Util.getAssemblerPattern(...) + */ +public interface IAssemblerPattern +{ + + IAssemblerCluster getCluster(); + + /** Returns a 3x3 matrix of nulls or ItemStacks, or null if it is not included. */ + ItemStack[] getCraftingMatrix(); + + /** + * Same as getCraftingMatrix(), but gets a crafting inventory for real crafting. + * + * Item pool is optional, null will work, but it won't be able to edit items... + */ + InventoryCrafting getCraftingInv( World w, IMEInventory itemPool, List missing, List used, IItemList all ); + + /** Returns a ItemStack, if the pattern is encoded, this will ALWAYS have a value. */ + ItemStack getOutput(); + + /** Returns true if there is a pattern encoded. */ + boolean isEncoded(); + + /** + * Encode a pattern. + * craftingMatrix - accepts a 3x3 grid of ItemStacks and Nulls. + * output - accepts a single ItemStack, NEVER SEND NULL + */ + void encodePattern(ItemStack[] craftingMatrix, ItemStack output); + + /** + * I have no idea what the World is for, its just part of IRecipe... + */ + boolean isCraftable(World w); + + /** + * Returns a condensed list of requirements. + * + * Example: sticks, will return a single stack of 2, rather then two stacks of 1. + * The same Item will not show more than one stack. + */ + public List condensedRequirements(); + + /** Returns the Tile Entity for the interface... */ + List getInterface(); + + /** Sets the Tile Entity for the interface... */ + void setInterface(IPushable a); + + /** returns the output of the pattern */ + ItemStack getRecipeOutput( InventoryCrafting ic, World w ); + + /** returns the recipe for the patterns */ + IRecipe getMatchingRecipe( InventoryCrafting ic, World w ); + + /** + * Compare to Patterns + * @param obj + * @return + */ + @Override + public boolean equals(Object obj); + +} + diff --git a/src/appeng/api/me/util/IConfigManager.java b/src/appeng/api/me/util/IConfigManager.java new file mode 100644 index 00000000000..42f3ae4c305 --- /dev/null +++ b/src/appeng/api/me/util/IConfigManager.java @@ -0,0 +1,10 @@ +package appeng.api.me.util; + +import appeng.api.config.IConfigEnum; +import appeng.api.me.tiles.IConfigureableTile; + +public interface IConfigManager extends IConfigureableTile +{ + + IConfigEnum getSetting( String sName ); +} diff --git a/src/appeng/api/me/util/ICraftRequest.java b/src/appeng/api/me/util/ICraftRequest.java new file mode 100644 index 00000000000..2812e514d76 --- /dev/null +++ b/src/appeng/api/me/util/ICraftRequest.java @@ -0,0 +1,9 @@ +package appeng.api.me.util; + +/** + * Pretty much just a place holder right now + * + */ +public interface ICraftRequest { + +} diff --git a/src/appeng/api/me/util/ICraftWatcher.java b/src/appeng/api/me/util/ICraftWatcher.java new file mode 100644 index 00000000000..2ba841081c8 --- /dev/null +++ b/src/appeng/api/me/util/ICraftWatcher.java @@ -0,0 +1,12 @@ +package appeng.api.me.util; + +/** + * Not used. + * + */ +public interface ICraftWatcher { + + void markChainCrafted(); + void markComplete( ICraftRequest cr ); + +} diff --git a/src/appeng/api/me/util/IGridCache.java b/src/appeng/api/me/util/IGridCache.java new file mode 100644 index 00000000000..3dce582b3f5 --- /dev/null +++ b/src/appeng/api/me/util/IGridCache.java @@ -0,0 +1,46 @@ +package appeng.api.me.util; + +import net.minecraft.nbt.NBTTagCompound; + +/** + * + * Allows you to cache information on the grid, for usage later, its up to you how you want to deal with saving/loading/resetting. + * + * Any Class that implements this, should have a default constructor that takes no arguments. + * + * Register this with Util.getAppEngApi().registerGridCache( MyGridCache.class ); + * + */ +public interface IGridCache { + + /** + * Called each time a network is reset ( changed ), the grid will persist your classes instance, but call this method. + * @param grid + */ + void reset( IGridInterface grid ); + + /** + * Called each tick for the controller, allows you to have active network wide behaviors. + * @param grid + */ + void onUpdateTick( IGridInterface grid ); + + /** + * used to uniquely identify your cache when saving/loading + * @return + */ + String getCacheName(); + + /** + * Save your caches state if necessary, if no saving is required, return null. + * @return + */ + NBTTagCompound savetoNBTData(); + + /** + * Load save cache data, this is called when a controller is loaded with previously saved data if there was no data, data will be an empty tag. + * @param data + */ + void loadfromNBTData( NBTTagCompound data ); + +} diff --git a/src/appeng/api/me/util/IGridInterface.java b/src/appeng/api/me/util/IGridInterface.java new file mode 100644 index 00000000000..441984f171a --- /dev/null +++ b/src/appeng/api/me/util/IGridInterface.java @@ -0,0 +1,219 @@ +package appeng.api.me.util; + +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import appeng.api.IAEItemStack; +import appeng.api.TileRef; +import appeng.api.exceptions.AppEngTileMissingException; +import appeng.api.me.tiles.IGridMachine; +import appeng.api.me.tiles.IGridTileEntity; +import appeng.api.me.tiles.IPushable; + +/** + * Lets you access network related features. You will mostly care about "getCellArray()" which returns the IMEInventory for the entire network... + */ +public interface IGridInterface +{ + /** + * Issue a new crafting request. + * @param whatToCraft + * @param showInMonitor + * @param enableRecursion + * @return the ICraftRequest + * @throws AppEngTileMissingException + */ + public ICraftRequest craftingRequest( ItemStack whatToCraft, boolean showInMonitor, boolean enableRecursion ) throws AppEngTileMissingException; + + /** + * deprecated version of creaftingRequest. + * @param what + * @return + * @throws AppEngTileMissingException + */ + public ICraftRequest craftingRequest( ItemStack what ) throws AppEngTileMissingException; + + /** + * opens the crafting gui. + * @param pmp + * @param gte + * @param s + * @throws AppEngTileMissingException + */ + public void craftGui( EntityPlayerMP pmp, IGridTileEntity gte, ItemStack s ) throws AppEngTileMissingException; + + /** + * Updates the interface requested, used internally + * @param te + */ + public void requestUpdate( IGridTileEntity te ); + + /** + * returns a list of all machines on the grid. + * @return + */ + List< TileRef > getMachines(); + + /** + * Labeled version for debugging... + */ + boolean useMEEnergy(float use, String for_what); + + /** + * returns energy to the system to prevent endless energy sinks. + */ + void refundMEEnergy( float use, String for_what ); + + /** + * Reports previous 20 ticks avg of energy usage. + * @return + */ + public float getPowerUsageAvg(); + + /** + * this is used for standard items, anything else just use useMEEnergy. + * @param items + * @param multipler + * @return + */ + int usePowerForAddition(int items, int multipler); + + /** + * returns a single IMEInventory that represents the entire networks. + * @return + */ + public IMEInventoryHandler getCellArray(); + + /** + * returns a single IMEInventory that represents the entire network, and all crafting available. + * @return + */ + public IMEInventoryHandler getFullCellArray(); + + /** + * add which users should be notified of terminal updates. + * @param p + */ + void addViewingPlayer(EntityPlayer p); + + /** + * remove which users should be notified of terminal updates. + * @param p + */ + void rmvViewingPlayer(EntityPlayer p); + + /** + * add which users should be notified of crafting queue updates. + * @param p + */ + void addCraftingPlayer(EntityPlayer p); + + /** + * remove which users should be notified of crafting queue updates. + * @param p + */ + void rmvCraftingPlayer(EntityPlayer p); + + /** + * aquire the controller tile entity. + * @return + */ + public TileEntity getController(); + + /** + * create a waiting job. + * @param what + * @return + */ + ICraftRequest waitingRequest(ItemStack what); + + /** + * creates a crafting job to push the item out of IPushable, and to enable crafting to acocomplish this goal. + * @param willAdd + * @param out + * @param allowCrafting + * @return + */ + ICraftRequest pushRequest( ItemStack willAdd, IPushable out, boolean allowCrafting ); + + /** + * is the grid valid? + * @return + */ + public boolean isValid(); + + /** + * tell AE to re-examin items in the waiting list. + */ + void resetWaitingQueue(); + + /** + * craftable items + * @return + */ + IMEInventoryHandler getCraftableArray(); + + /** + * get a numeric id for this grid, used internally for cable animations, and not much else. + * @return + */ + public int getGridIndex(); + + /** + * Try to find the pattern for the item in question. + * @param req + * @return + */ + public IAssemblerPattern getPatternFor(ItemStack req); + + /** + * Inform the network that power costs have changed. + */ + public void triggerPowerUpdate(); + + /** + * Inform the netowrk that these items were removed from storage ( don't do this for items remove though the grid, it already knows about those. ) + * @param removed + */ + public void notifyExtractItems(IAEItemStack removed); + + /** + * Inform the network that these items were added to storage ( don't do this for items added via the grid, it already knows about those. ) + * @param vo + */ + public void notifyAddItems(IAEItemStack vo); + + /** + * return a cache by its identifier ( the number you get when you register your cache with AE ) + * @param id + * @return + */ + public IGridCache getCacheByID( int id ); + + /** + * Potential future use, for now just returns the network encryption key. + * @return + */ + public String getName(); + + /** + * inform the network that energy was transfered between two nodes on the network, + * this will be used to calculates future information, but also causes the network + * to flash presently. + * + * this will automatically be handled by the standard extractItem / addItem API in the future, only + * Processes that skip the vanilla AE storage system should use this. + * + * @param a + * @param b + * @param amt + */ + void signalEnergyTransfer(IGridTileEntity a, IGridTileEntity b, float amt); + + @Override + public boolean equals(Object obj); + +} diff --git a/src/appeng/api/me/util/ILocationPattern.java b/src/appeng/api/me/util/ILocationPattern.java new file mode 100644 index 00000000000..49b62cf384d --- /dev/null +++ b/src/appeng/api/me/util/ILocationPattern.java @@ -0,0 +1,12 @@ +package appeng.api.me.util; + +import appeng.api.WorldCoord; + +/** + * Lets you Access Internal Location Pattern data. + */ +public interface ILocationPattern { + WorldCoord getLocation(); + + void setLocation(int x, int y, int z); +} diff --git a/src/appeng/api/me/util/IMEInventory.java b/src/appeng/api/me/util/IMEInventory.java new file mode 100644 index 00000000000..3e3691497a1 --- /dev/null +++ b/src/appeng/api/me/util/IMEInventory.java @@ -0,0 +1,77 @@ +package appeng.api.me.util; + +import appeng.api.IAEItemStack; +import appeng.api.IItemList; + +/** + * Lets you access Internal Cell Inventories. + */ +public interface IMEInventory +{ + /** + * The number of different item types stored in inventory. + */ + public long storedItemTypes(); + + /** + * The number of stored items total, regardless of type. + */ + public long storedItemCount(); + + /** + * The estimated number of additional items this inventory can hold, regardless of type. + */ + public long remainingItemCount(); + + /** + * The estimated number of additional types the inventory could hold. + */ + public long remainingItemTypes(); + + /** + * True or False if this item is inside this inventory. + */ + public boolean containsItemType(IAEItemStack i); + + /** + * The total number of types holdable in this inventory. + */ + public long getTotalItemTypes(); + + /** + * Returns how many of this item are in the inventory, regardless of a how many stacks / cells or anything else. + */ + public long countOfItemType(IAEItemStack i); + + /** + * Adds input, to the inventory, and returns items not added, complete failure yields a copy of the stack that was passed. + */ + public IAEItemStack addItems( IAEItemStack input ); + + /** + * Attempts to extract the requested item, in the count specified by the request, returns items extracted, complete failure yields NULL. + */ + public IAEItemStack extractItems( IAEItemStack request ); + + // DO NOT USE ItemStack.split, these are for information purpose ONLY! + // I you wan to remove items from the cell, use extractItemss + + /** + * Returns a list of all available items, with stackSize set to the real amount, without stack limits. + */ + public IItemList getAvailableItems( IItemList out ); + + /** + * Returns a list of all available items, with stackSize set to the real amount, without stack limits. + */ + public IItemList getAvailableItems(); + + /** + * Identical to addItems(...) but it don't change anything, its just a simulation. + * this is used when dealing with pipes/tubes, and routing. + */ + public IAEItemStack calculateItemAddition(IAEItemStack stack); + + // calculates available space for a specific item. + public long getAvailableSpaceByItem( IAEItemStack i, long maxNeeded ); +} diff --git a/src/appeng/api/me/util/IMEInventoryHandler.java b/src/appeng/api/me/util/IMEInventoryHandler.java new file mode 100644 index 00000000000..947f517888f --- /dev/null +++ b/src/appeng/api/me/util/IMEInventoryHandler.java @@ -0,0 +1,76 @@ +package appeng.api.me.util; + +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import appeng.api.IAEItemStack; +import appeng.api.IItemList; +import appeng.api.config.FuzzyMode; +import appeng.api.config.IConfigEnum; +import appeng.api.config.ItemFlow; +import appeng.api.config.ListMode; + +public interface IMEInventoryHandler extends IMEInventory { + + public ItemFlow getFlow(); + public void setFlow( ItemFlow p ); + + public int getPriority(); + public void setPriority( int p ); + + /** + * Returns estimated number of total bytes represented by the inventory, used mainly for display. + */ + public long totalBytes(); + + /** + * Returns estimated number of free bytes represented by inventory, used mainly for display. + */ + public long freeBytes(); + + /** + * Returns number of used bytes represented by the inventory, used mainly for display. + */ + public long usedBytes(); + + /** + * The number of items you could add before the freeBytes() decreases. + */ + public long unusedItemCount(); + + /** + * True of False, if you could add a new item type. + */ + public boolean canHoldNewItem(); + + /** + * This tells you where it found your cell, so if your cell changes, you should update this block... + */ + void setUpdateTarget(TileEntity e); + + List getPreformattedItems(); + void setPreformattedItems(IItemList in, FuzzyMode mode, ListMode m); + + boolean isPreformatted(); + boolean isFuzzyPreformatted(); + + ListMode getListMode(); + FuzzyMode getFuzzyModePreformatted(); + + void setFuzzyPreformatted( boolean nf ); + + public void setName(String name); + String getName(); + + void setGrid( IGridInterface grid ); + IGridInterface getGrid(); + + void setParent( IMEInventoryHandler p ); + IMEInventoryHandler getParent(); + + void removeGrid(IGridInterface grid, IMEInventoryHandler ignore, List duplicates ); + public void validate( List duplicates ); + public boolean canAccept(IAEItemStack input); + +} diff --git a/src/appeng/api/me/util/IMEInventoryUtil.java b/src/appeng/api/me/util/IMEInventoryUtil.java new file mode 100644 index 00000000000..e43bce072e7 --- /dev/null +++ b/src/appeng/api/me/util/IMEInventoryUtil.java @@ -0,0 +1,19 @@ +package appeng.api.me.util; + +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.world.World; +import appeng.api.IAEItemStack; +import appeng.api.IItemList; + +public interface IMEInventoryUtil { + + // ignores meta data - is always Fuzzy... + // will only remove single items, this ignores your stack size... + public ItemStack extractItemsByRecipe(World w, IRecipe r, ItemStack output, InventoryCrafting ci, ItemStack providedTemplate, int slot, IItemList all ); + + // ignores meta data - is always Fuzzy... + //public ItemStack extractItemsByType( ItemStack is ); // will only remove single items, this ignores your stack size... + +} diff --git a/src/appeng/api/me/util/InterfaceCraftingResponse.java b/src/appeng/api/me/util/InterfaceCraftingResponse.java new file mode 100644 index 00000000000..6a50915e5d7 --- /dev/null +++ b/src/appeng/api/me/util/InterfaceCraftingResponse.java @@ -0,0 +1,13 @@ +package appeng.api.me.util; + +import java.util.List; + +import net.minecraft.item.ItemStack; + +public class InterfaceCraftingResponse { + + public ItemStack Request; + + public List UsedMaterials; + +} diff --git a/src/tconstruct/library/tools/ToolCore.java b/src/tconstruct/library/tools/ToolCore.java index 3a5bfa32010..5ef30c6fc98 100644 --- a/src/tconstruct/library/tools/ToolCore.java +++ b/src/tconstruct/library/tools/ToolCore.java @@ -9,6 +9,9 @@ import java.util.Map; import java.util.Random; +import appeng.api.IAEItemStack; +import appeng.api.me.items.IAEChargeableItem; +import appeng.api.me.items.IStorageCell; import mods.battlegear2.api.weapons.IBattlegearWeapon; import mods.battlegear2.api.weapons.OffhandAttackEvent; import net.minecraft.block.Block; @@ -56,7 +59,7 @@ * @see ToolMod */ -public abstract class ToolCore extends Item implements ICustomElectricItem, IBoxable, IBattlegearWeapon//, IStorageCell, IAEChargeableItem +public abstract class ToolCore extends Item implements ICustomElectricItem, IBoxable, IBattlegearWeapon, IStorageCell, IAEChargeableItem { protected Random random = new Random(); protected int damageVsEntity; @@ -989,7 +992,7 @@ public void performPassiveEffects (Side effectiveSide, ItemStack mainhandItem, I } /* Applied Energistics support, IAEChargableItem */ - /*@Override + @Override public float addEnergy (ItemStack target, float energy) { // TODO Auto-generated method stub @@ -1001,10 +1004,10 @@ public boolean isChargeable (ItemStack it) { // TODO Auto-generated method stub return false; - }*/ + } /* Applied Energistics support, IStorageCell */ - /*@Override + @Override public int getBytes (ItemStack cellItem) { // TODO Auto-generated method stub @@ -1036,5 +1039,5 @@ public boolean storableInStorageCell () { // TODO Auto-generated method stub return false; - }*/ + } }