diff --git a/resources/assets/storagedrawers/lang/en_US.lang b/resources/assets/storagedrawers/lang/en_US.lang index a500380..72361ce 100644 --- a/resources/assets/storagedrawers/lang/en_US.lang +++ b/resources/assets/storagedrawers/lang/en_US.lang @@ -89,4 +89,14 @@ storageDrawers.config.prop.enabled.tooltip=Enable block in game. storageDrawers.config.prop.baseStorage=Base Storage storageDrawers.config.prop.baseStorage.tooltip=Number of stacks held per drawer. storageDrawers.config.prop.recipeOutput=Recipe Output -storageDrawers.config.prop.recipeOutput.tooltip=Number of items from single crafting. \ No newline at end of file +storageDrawers.config.prop.recipeOutput.tooltip=Number of items from single crafting. +storageDrawers.config.prop.enableSidedInput=Enable Sided Input +storageDrawers.config.prop.enableSidedInput.tooltip=Other blocks can insert items into drawers. +storageDrawers.config.prop.enableSidedOutput=Enable Sided Output +storageDrawers.config.prop.enableSidedOutput.tooltip=Other blocks can extract items from drawers. + +storageDrawers.config.integration=Integration +storageDrawers.config.integration.tooltip=Configure integration with other mods. + +storageDrawers.config.integration.enableAE2=Enable Applied Energistics 2 Integration +storageDrawers.config.integration.enableWaila=Enable WAILA Integration \ No newline at end of file diff --git a/src/com/jaquadro/minecraft/storagedrawers/api/registry/IIngredientHandler.java b/src/com/jaquadro/minecraft/storagedrawers/api/registry/IIngredientHandler.java index 5d30c05..a7432b2 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/api/registry/IIngredientHandler.java +++ b/src/com/jaquadro/minecraft/storagedrawers/api/registry/IIngredientHandler.java @@ -2,7 +2,18 @@ package com.jaquadro.minecraft.storagedrawers.api.registry; import net.minecraft.item.ItemStack; +/** + * Ingredient handlers are used to get ItemStacks from ingredients in custom IRecipe implementations. If you have + * registered an IRecipeHandler that returns lists of objects that aren't ItemStacks, then you will need to + * implement an ingredient handler for those objects. + */ public interface IIngredientHandler { + /** + * Gets an ItemStack from an object that represents an ingredient in an IRecipe. + * + * @param object An ingredient object. + * @return An ItemStack for the given ingredient. + */ ItemStack getItemStack (Object object); } diff --git a/src/com/jaquadro/minecraft/storagedrawers/api/registry/IRecipeHandler.java b/src/com/jaquadro/minecraft/storagedrawers/api/registry/IRecipeHandler.java index 87f2953..d4311ea 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/api/registry/IRecipeHandler.java +++ b/src/com/jaquadro/minecraft/storagedrawers/api/registry/IRecipeHandler.java @@ -4,9 +4,33 @@ import net.minecraft.item.crafting.IRecipe; import java.util.List; +/** + * Recipe handlers are used by compacting drawers to find more-compressed forms of blocks and items. If your recipe + * to craft compressed items is a custom IRecipe implementation, you will need to register a handler for it. + */ public interface IRecipeHandler { + /** + * Get the recipe ingredient list as an array of objects (usually used for shaped recipes). + * If your array does not contain ItemStack objects, you will need to register an {@link IIngredientHandler} to + * get an ItemStack from them. + * + * If you would prefer to return a List, return null in this method and implement {@link #getInputAsList}. + * + * @param recipe An instance of a custom {@link IRecipe}. + * @return An array of ItemStacks or objects with a registered {@link IIngredientHandler}. + */ Object[] getInputAsArray (IRecipe recipe); + /** + * Get the recipe ingredient list as a list of objects (usually used for shapeless recipes). + * If your list does not contain ItemStack objects, you will need to register an {@link IIngredientHandler} to + * get an ItemStack from them. + * + * If you would prefer to return an array, return null in this method and implement {@link #getInputAsArray}. + * + * @param recipe An instance of a custom {@link IRecipe}. + * @return A list of ItemStacks or objects with a registered {@link IIngredientHandler}. + */ List getInputAsList (IRecipe recipe); } diff --git a/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java b/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java index 13bbc08..1876c7e 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java +++ b/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java @@ -56,6 +56,10 @@ public class ConfigManager public boolean renderStorageUpgrades; public String itemRenderType; public boolean creativeTabVanillaWoods; + public boolean enableSidedInput; + public boolean enableSidedOutput; + public boolean enableWailaIntegration; + public boolean enableAE2Integration; public int level2Mult; public int level3Mult; @@ -71,6 +75,7 @@ public class ConfigManager public final List sections = new ArrayList(); public final ConfigSection sectionGeneral = new ConfigSection(sections, "general", "general"); + public final ConfigSection sectionIntegration = new ConfigSection(sections, "integration", "integration"); public final ConfigSection sectionBlocks = new ConfigSection(sections, "blocks", "blocks"); public final ConfigSection sectionUpgrades = new ConfigSection(sections, "upgrades", "upgrades"); @@ -105,9 +110,14 @@ public class ConfigManager public void syncConfig () { cache.enableIndicatorUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableIndicatorUpgrades", true).setLanguageKey(LANG_PREFIX + "prop.enableIndicatorUpgrades").setRequiresMcRestart(true).getBoolean(); cache.enableStorageUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableStorageUpgrades", true).setLanguageKey(LANG_PREFIX + "prop.enableStorageUpgrades").setRequiresMcRestart(true).getBoolean(); - cache.itemRenderType = config.get(Configuration.CATEGORY_GENERAL, "itemRenderType", "fancy", null, new String[] { "fancy", "fast" }).setLanguageKey(LANG_PREFIX + "prop.itemRenderType").getString(); + cache.itemRenderType = config.get(Configuration.CATEGORY_GENERAL, "itemRenderType", "fast", null, new String[] { "fancy", "fast" }).setLanguageKey(LANG_PREFIX + "prop.itemRenderType").getString(); cache.renderStorageUpgrades = config.get(Configuration.CATEGORY_GENERAL, "renderStorageUpgrades", true).setLanguageKey(LANG_PREFIX + "prop.renderStorageUpgrades").getBoolean(); cache.creativeTabVanillaWoods = config.get(Configuration.CATEGORY_GENERAL, "creativeTabVanillaWoods", true).setLanguageKey(LANG_PREFIX + "prop.creativeTabVanillaWoods").getBoolean(); + cache.enableSidedInput = config.get(Configuration.CATEGORY_GENERAL, "enableSidedInput", true).setLanguageKey(LANG_PREFIX + "prop.enableSidedInput").getBoolean(); + cache.enableSidedOutput = config.get(Configuration.CATEGORY_GENERAL, "enableSidedOutput", true).setLanguageKey(LANG_PREFIX + "prop.enableSidedOutput").getBoolean(); + + cache.enableAE2Integration = config.get(sectionIntegration.getQualifiedName(), "enableAE2", true).setLanguageKey(LANG_PREFIX + "integration.enableAE2").setRequiresMcRestart(true).getBoolean(); + cache.enableWailaIntegration = config.get(sectionIntegration.getQualifiedName(), "enableWaila", true).setLanguageKey(LANG_PREFIX + "integration.enableWaila").setRequiresMcRestart(true).getBoolean(); config.get(sectionBlocksFullDrawers1x2.getQualifiedName(), "enabled", true).setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true); config.get(sectionBlocksFullDrawers1x2.getQualifiedName(), "baseStorage", 8).setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true); diff --git a/src/com/jaquadro/minecraft/storagedrawers/integration/IntegrationRegistry.java b/src/com/jaquadro/minecraft/storagedrawers/integration/IntegrationRegistry.java index 3d5e364..d543e43 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/integration/IntegrationRegistry.java +++ b/src/com/jaquadro/minecraft/storagedrawers/integration/IntegrationRegistry.java @@ -16,9 +16,9 @@ public class IntegrationRegistry static { IntegrationRegistry reg = instance(); - if (Loader.isModLoaded("appliedenergistics2")) + if (Loader.isModLoaded("appliedenergistics2") && StorageDrawers.config.cache.enableAE2Integration) reg.add(new AppliedEnergistics()); - if (Loader.isModLoaded("Waila")) + if (Loader.isModLoaded("Waila") && StorageDrawers.config.cache.enableWailaIntegration) reg.add(new Waila()); } diff --git a/src/com/jaquadro/minecraft/storagedrawers/inventory/StorageInventory.java b/src/com/jaquadro/minecraft/storagedrawers/inventory/StorageInventory.java index 4905f86..b3ae0f8 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/inventory/StorageInventory.java +++ b/src/com/jaquadro/minecraft/storagedrawers/inventory/StorageInventory.java @@ -1,5 +1,6 @@ package com.jaquadro.minecraft.storagedrawers.inventory; +import com.jaquadro.minecraft.storagedrawers.StorageDrawers; import com.jaquadro.minecraft.storagedrawers.api.inventory.IInventoryAdapter; import com.jaquadro.minecraft.storagedrawers.api.inventory.SlotType; import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer; @@ -54,6 +55,9 @@ public class StorageInventory implements IDrawerInventory @Override public boolean canInsertItem (int slot, ItemStack item, int side) { + if (!StorageDrawers.config.cache.enableSidedInput) + return false; + int lowerThresh = SlotType.INPUT.ordinal() * group.getDrawerCount(); int upperThresh = lowerThresh + group.getDrawerCount(); if (slot < lowerThresh || slot >= upperThresh) @@ -68,6 +72,9 @@ public class StorageInventory implements IDrawerInventory @Override public boolean canExtractItem (int slot, ItemStack item, int side) { + if (!StorageDrawers.config.cache.enableSidedOutput) + return false; + int lowerThresh = SlotType.OUTPUT.ordinal() * group.getDrawerCount(); int upperThresh = lowerThresh + group.getDrawerCount(); if (slot < lowerThresh || slot >= upperThresh)