diff --git a/resources/assets/storagedrawers/lang/en_US.lang b/resources/assets/storagedrawers/lang/en_US.lang index 35af79f..1342d2a 100644 --- a/resources/assets/storagedrawers/lang/en_US.lang +++ b/resources/assets/storagedrawers/lang/en_US.lang @@ -146,6 +146,8 @@ storageDrawers.config.prop.enableSidedOutput=Enable Sided Output storageDrawers.config.prop.enableSidedOutput.tooltip=Other blocks can extract items from drawers. storageDrawers.config.prop.enableItemConversion=Enable Item Conversion storageDrawers.config.prop.enableItemConversion.tooltip=Drawers auto-convert ore dictionary compatible items. +storageDrawers.config.prop.enableFallbackRecipes=Enable Fallback Recipes +storageDrawers.config.prop.enableFallbackRecipes.tooltip=Any valid plank wood can craft oak drawers. storageDrawers.config.prop.invertShift=Invert Shift storageDrawers.config.prop.invertShift.tooltip=Inverts click and shift+click behavior. storageDrawers.config.prop.enableDebugLogging=Enable Debug Logging diff --git a/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java b/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java index 8a503d4..d175540 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java +++ b/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java @@ -73,6 +73,7 @@ public class ConfigManager public boolean enableMineTweakerIntegration; public boolean enableRefinedRelocationIntegration; public boolean enableTape; + public boolean enableFallbackRecipes; public boolean invertShift; public boolean debugTrace; @@ -232,6 +233,7 @@ public class ConfigManager 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.enableItemConversion = config.get(Configuration.CATEGORY_GENERAL, "enableItemConversion", true).setLanguageKey(LANG_PREFIX + "prop.enableItemConversion").getBoolean(); + cache.enableFallbackRecipes = config.get(Configuration.CATEGORY_GENERAL, "enableFallbackRecipes", true).setLanguageKey(LANG_PREFIX + "prop.enableFallbackRecipes").setRequiresMcRestart(true).getBoolean(); cache.invertShift = config.get(Configuration.CATEGORY_GENERAL, "invertShift", false, "Inverts how shift works with drawers. If this is true, shifting will only give one item, where regular clicks will give a full stack. Leave false for default behavior.") .setLanguageKey(LANG_PREFIX + "prop.invertShift").getBoolean(); diff --git a/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java b/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java index 8fad105..764c1db 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java +++ b/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java @@ -3,6 +3,7 @@ package com.jaquadro.minecraft.storagedrawers.core; import com.jaquadro.minecraft.storagedrawers.StorageDrawers; import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers; import com.jaquadro.minecraft.storagedrawers.config.ConfigManager; +import com.jaquadro.minecraft.storagedrawers.core.recipe.FallbackShapedOreRecipe; import cpw.mods.fml.common.registry.GameRegistry; import minetweaker.mc1710.recipes.ShapedRecipeOre; import net.minecraft.block.BlockWood; @@ -10,12 +11,15 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.RecipeSorter; import net.minecraftforge.oredict.ShapedOreRecipe; public class ModRecipes { public void init () { OreDictionary.registerOre("chestWood", new ItemStack(Blocks.chest)); // Remove when porting to 1.8 + + RecipeSorter.register("StorageDrawers:FallbackShapedOreRecipe", FallbackShapedOreRecipe.class, RecipeSorter.Category.SHAPED, "after:minecraft:shapedore"); ConfigManager config = StorageDrawers.config; @@ -42,24 +46,26 @@ public class ModRecipes } // Fallback recipes - if (config.isBlockEnabled("fulldrawers1")) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers1, config.getBlockRecipeOutput("fulldrawers1"), 0), "xxx", " y ", "xxx", - 'x', "plankWood", 'y', "chestWood")); - if (config.isBlockEnabled("fulldrawers2")) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers2, config.getBlockRecipeOutput("fulldrawers2"), 0), "xyx", "xxx", "xyx", - 'x', "plankWood", 'y', "chestWood")); - if (config.isBlockEnabled("halfdrawers2")) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers2, config.getBlockRecipeOutput("halfdrawers2"), 0), "xyx", "xxx", "xyx", - 'x', "plankWood", 'y', "chestWood")); - if (config.isBlockEnabled("fulldrawers4")) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers4, config.getBlockRecipeOutput("fulldrawers4"), 0), "yxy", "xxx", "yxy", - 'x', "slabWood", 'y', "chestWood")); - if (config.isBlockEnabled("halfdrawers4")) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers4, config.getBlockRecipeOutput("halfdrawers4"), 0), "yxy", "xxx", "yxy", - 'x', "slabWood", 'y', "chestWood")); - if (config.isBlockEnabled("trim")) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.trim, config.getBlockRecipeOutput("trim"), 0), "xyx", "yyy", "xyx", - 'x', "stickWood", 'y', "plankWood")); + if (config.cache.enableFallbackRecipes) { + if (config.isBlockEnabled("fulldrawers1")) + GameRegistry.addRecipe(new FallbackShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers1, config.getBlockRecipeOutput("fulldrawers1"), 0), "xxx", " y ", "xxx", + 'x', "plankWood", 'y', "chestWood")); + if (config.isBlockEnabled("fulldrawers2")) + GameRegistry.addRecipe(new FallbackShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers2, config.getBlockRecipeOutput("fulldrawers2"), 0), "xyx", "xxx", "xyx", + 'x', "plankWood", 'y', "chestWood")); + if (config.isBlockEnabled("halfdrawers2")) + GameRegistry.addRecipe(new FallbackShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers2, config.getBlockRecipeOutput("halfdrawers2"), 0), "xyx", "xxx", "xyx", + 'x', "slabWood", 'y', "chestWood")); + if (config.isBlockEnabled("fulldrawers4")) + GameRegistry.addRecipe(new FallbackShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers4, config.getBlockRecipeOutput("fulldrawers4"), 0), "yxy", "xxx", "yxy", + 'x', "plankWood", 'y', "chestWood")); + if (config.isBlockEnabled("halfdrawers4")) + GameRegistry.addRecipe(new FallbackShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers4, config.getBlockRecipeOutput("halfdrawers4"), 0), "yxy", "xxx", "yxy", + 'x', "slabWood", 'y', "chestWood")); + if (config.isBlockEnabled("trim")) + GameRegistry.addRecipe(new FallbackShapedOreRecipe(new ItemStack(ModBlocks.trim, config.getBlockRecipeOutput("trim"), 0), "xyx", "yyy", "xyx", + 'x', "stickWood", 'y', "plankWood")); + } if (config.isBlockEnabled("compdrawers")) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.compDrawers, config.getBlockRecipeOutput("compdrawers")), "xxx", "zwz", "xyx", diff --git a/src/com/jaquadro/minecraft/storagedrawers/core/recipe/FallbackShapedOreRecipe.java b/src/com/jaquadro/minecraft/storagedrawers/core/recipe/FallbackShapedOreRecipe.java new file mode 100644 index 0000000..5694ffe --- /dev/null +++ b/src/com/jaquadro/minecraft/storagedrawers/core/recipe/FallbackShapedOreRecipe.java @@ -0,0 +1,21 @@ +package com.jaquadro.minecraft.storagedrawers.core.recipe; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.ShapedOreRecipe; + +public class FallbackShapedOreRecipe extends ShapedOreRecipe +{ + public FallbackShapedOreRecipe (Block result, Object... recipe) { + super(result, recipe); + } + + public FallbackShapedOreRecipe (Item result, Object... recipe) { + super(result, recipe); + } + + public FallbackShapedOreRecipe (ItemStack result, Object... recipe) { + super(result, recipe); + } +}