Place IAutoCrafter interface into AutoCrafting class
Looking at saving space plus its a one method interface
This commit is contained in:
parent
5a563266cc
commit
c9a8298058
3 changed files with 20 additions and 26 deletions
|
@ -26,27 +26,22 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import dark.common.BlockRegistry.BlockData;
|
||||
import dark.common.blocks.BlockOre;
|
||||
import dark.common.debug.BlockDebug;
|
||||
import dark.common.debug.BlockDebug.debugBlocks;
|
||||
import dark.common.items.EnumMeterials;
|
||||
import dark.common.items.ItemBattery;
|
||||
import dark.common.items.ItemBlockOre;
|
||||
import dark.common.items.ItemOreDirv;
|
||||
import dark.common.items.ItemParts;
|
||||
import dark.common.items.ItemParts.Parts;
|
||||
import dark.common.items.ItemTools;
|
||||
import dark.common.items.ItemWrench;
|
||||
import dark.common.items.ItemParts.Parts;
|
||||
import dark.common.transmit.BlockWire;
|
||||
import dark.common.transmit.TileEntityWire;
|
||||
import dark.prefab.BlockMulti;
|
||||
import dark.prefab.ModPrefab;
|
||||
import dark.prefab.TileEntityMulti;
|
||||
import dark.prefab.helpers.FluidRestrictionHandler;
|
||||
import dark.prefab.helpers.SaveManager;
|
||||
import dark.prefab.items.ItemBlockHolder;
|
||||
|
||||
/** @author HangCow, DarkGuardsman */
|
||||
@Mod(modid = DarkMain.MOD_ID, name = DarkMain.MOD_NAME, version = DarkMain.VERSION, dependencies = "after:BuildCraft|Energy", useMetadata = true)
|
||||
|
@ -221,13 +216,13 @@ public class DarkMain extends ModPrefab
|
|||
@ForgeSubscribe
|
||||
public void onWorldSave(WorldEvent.Save event)
|
||||
{
|
||||
SaveManager.save(!event.world.isRemote);
|
||||
//SaveManager.save(!event.world.isRemote);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStopping(FMLServerStoppingEvent event)
|
||||
{
|
||||
SaveManager.save(true);
|
||||
//SaveManager.save(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
|
|||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
/** Rewrite of the imprinter crafting system into its own manageable class
|
||||
*
|
||||
*
|
||||
* @author DarkGuardsman */
|
||||
public class AutoCraftingManager
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ public class AutoCraftingManager
|
|||
}
|
||||
|
||||
/** Does this player's inventory contain the required resources to craft this item?
|
||||
*
|
||||
*
|
||||
* @return Required items to make the desired item. */
|
||||
public Pair<ItemStack, ItemStack[]> getIdealRecipe(ItemStack outputItem)
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ public class AutoCraftingManager
|
|||
}
|
||||
|
||||
/** Gets the itemStacks in the inv based on slots
|
||||
*
|
||||
*
|
||||
* @param inv - @IInventory instance
|
||||
* @param slots - slot # to be used
|
||||
* @return array of itemStack the same size as the slots input array */
|
||||
|
@ -143,7 +143,7 @@ public class AutoCraftingManager
|
|||
}
|
||||
|
||||
/** Returns if the following inventory has the following resource required.
|
||||
*
|
||||
*
|
||||
* @param recipeItems - The items to be checked for the recipes. */
|
||||
public ArrayList<ItemStack> hasResource(Object[] recipeItems)
|
||||
{
|
||||
|
@ -231,7 +231,7 @@ public class AutoCraftingManager
|
|||
}
|
||||
|
||||
/** Decreases the stack by a set amount
|
||||
*
|
||||
*
|
||||
* @param stack - starting stack
|
||||
* @param amount - amount of items
|
||||
* @return the edited stack */
|
||||
|
@ -262,7 +262,7 @@ public class AutoCraftingManager
|
|||
}
|
||||
|
||||
/** Checks if an item exist within the inv array
|
||||
*
|
||||
*
|
||||
* @param recipeItem - itemstack being searched for
|
||||
* @param containingItems - inv array containing the search bounds
|
||||
* @return the point in the array the item was found -1 = the item was null or not valid -2 =
|
||||
|
@ -294,14 +294,14 @@ public class AutoCraftingManager
|
|||
|
||||
/** Checks if itemstack are equal based on crafting result rather than normal itemstack this is
|
||||
* done so that if the itemstack returns with
|
||||
*
|
||||
*
|
||||
* @param recipeItem - itemstack being compared
|
||||
* @param checkStack - itemstack being comparted
|
||||
* @return true if the items are a match for each other
|
||||
*
|
||||
*
|
||||
* If the item can't be stack and is able to take damage the item will be check on damaged
|
||||
* status
|
||||
*
|
||||
*
|
||||
* If the item's meta data is not normal or in other words equals 32767 the meta data will be
|
||||
* ignored */
|
||||
public static boolean areStacksEqual(ItemStack recipeItem, ItemStack checkStack)
|
||||
|
@ -322,7 +322,7 @@ public class AutoCraftingManager
|
|||
}
|
||||
|
||||
/** Consumes an item checking for extra conditions like container items
|
||||
*
|
||||
*
|
||||
* @param stack - starting itemStack
|
||||
* @param ammount - amount to consume
|
||||
* @return what is left of the itemStack if any */
|
||||
|
@ -367,7 +367,7 @@ public class AutoCraftingManager
|
|||
}
|
||||
|
||||
/** Used to automatically remove selected items from crafting inv
|
||||
*
|
||||
*
|
||||
* @param requiredItems - items that are to be removed */
|
||||
public void consumeItems(ItemStack... requiredItems)
|
||||
{
|
||||
|
@ -394,4 +394,10 @@ public class AutoCraftingManager
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static interface IAutoCrafter
|
||||
{
|
||||
/** The slots used by the crafter for resources */
|
||||
public int[] getCraftingInv();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
package dark.prefab.helpers;
|
||||
|
||||
public interface IAutoCrafter
|
||||
{
|
||||
/** The slots used by the crafter for resources */
|
||||
public int[] getCraftingInv();
|
||||
}
|
Loading…
Reference in a new issue