Don't register recipes for nonregistered blocks/items. Add recipe output size config option.

This commit is contained in:
Justin Aquadro committed 2014-09-19 19:51:50 -04:00
1 parent 26a1f55d90
commit 5a7f712aaf
3 files changed
+67 -35

No files matched your search

@@ -85,4 +85,6 @@ storageDrawers.config.prop.renderStorageUpgrades=Render Storage Upgrades
storageDrawers.config.prop.enabled=Enabled
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.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.
@@ -109,18 +109,23 @@ public class ConfigManager
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);
config.get(sectionBlocksFullDrawers1x2.getQualifiedName(), "recipeOutput", 2).setLanguageKey(LANG_PREFIX + "prop.recipeOutput").setRequiresMcRestart(true);
config.get(sectionBlocksFullDrawers2x2.getQualifiedName(), "enabled", true).setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksFullDrawers2x2.getQualifiedName(), "baseStorage", 4).setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
config.get(sectionBlocksFullDrawers2x2.getQualifiedName(), "recipeOutput", 4).setLanguageKey(LANG_PREFIX + "prop.recipeOutput").setRequiresMcRestart(true);
config.get(sectionBlocksHalfDrawers1x2.getQualifiedName(), "enabled", true).setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksHalfDrawers1x2.getQualifiedName(), "baseStorage", 4).setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
config.get(sectionBlocksHalfDrawers1x2.getQualifiedName(), "recipeOutput", 2).setLanguageKey(LANG_PREFIX + "prop.recipeOutput").setRequiresMcRestart(true);
config.get(sectionBlocksHalfDrawers2x2.getQualifiedName(), "enabled", true).setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksHalfDrawers2x2.getQualifiedName(), "baseStorage", 2).setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
config.get(sectionBlocksHalfDrawers2x2.getQualifiedName(), "recipeOutput", 4).setLanguageKey(LANG_PREFIX + "prop.recipeOutput").setRequiresMcRestart(true);
config.get(sectionBlocksCompDrawers.getQualifiedName(), "enabled", true).setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksCompDrawers.getQualifiedName(), "baseStorage", 8).setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
config.get(sectionBlocksCompDrawers.getQualifiedName(), "recipeOutput", 1).setLanguageKey(LANG_PREFIX + "prop.recipeOutput").setRequiresMcRestart(true);
cache.level2Mult = config.get(sectionUpgrades.getQualifiedName(), "level2Mult", 2).setLanguageKey(LANG_PREFIX + "upgrades.level2Mult").setRequiresWorldRestart(true).getInt();
cache.level3Mult = config.get(sectionUpgrades.getQualifiedName(), "level3Mult", 3).setLanguageKey(LANG_PREFIX + "upgrades.level3Mult").setRequiresWorldRestart(true).getInt();
@@ -156,6 +161,14 @@ public class ConfigManager
return section.getCategory().get("baseStorage").getInt();
}
public int getBlockRecipeOutput (String blockName) {
if (!blockSectionsMap.containsKey(blockName))
return 0;
ConfigSection section = blockSectionsMap.get(blockName);
return section.getCategory().get("recipeOutput").getInt();
}
public int getStorageUpgradeMultiplier (int level) {
switch (level) {
case 2: return cache.level2Mult;
@@ -1,6 +1,8 @@
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 cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.BlockWood;
import net.minecraft.init.Blocks;
@@ -11,45 +13,60 @@ import net.minecraftforge.oredict.OreDictionary;
public class ModRecipes
{
public void init () {
ConfigManager config = StorageDrawers.config;
for (int i = 0; i < BlockWood.field_150096_a.length; i++) {
GameRegistry.addRecipe(new ItemStack(ModBlocks.fullDrawers2, 2, i), "xyx", "xxx", "xyx",
'x', new ItemStack(Blocks.planks, 1, i), 'y', Blocks.chest);
GameRegistry.addRecipe(new ItemStack(ModBlocks.halfDrawers2, 2, i), "xyx", "xxx", "xyx",
'x', new ItemStack(Blocks.wooden_slab, 1, i), 'y', Blocks.chest);
GameRegistry.addRecipe(new ItemStack(ModBlocks.fullDrawers4, 4, i), "yxy", "xxx", "yxy",
'x', new ItemStack(Blocks.planks, 1, i), 'y', Blocks.chest);
GameRegistry.addRecipe(new ItemStack(ModBlocks.halfDrawers4, 4, i), "yxy", "xxx", "yxy",
'x', new ItemStack(Blocks.wooden_slab, 1, i), 'y', Blocks.chest);
if (config.isBlockEnabled("fullDrawers2"))
GameRegistry.addRecipe(new ItemStack(ModBlocks.fullDrawers2, config.getBlockRecipeOutput("fullDrawers2"), i), "xyx", "xxx", "xyx",
'x', new ItemStack(Blocks.planks, 1, i), 'y', Blocks.chest);
if (config.isBlockEnabled("halfDrawers2"))
GameRegistry.addRecipe(new ItemStack(ModBlocks.halfDrawers2, config.getBlockRecipeOutput("halfDrawers2"), i), "xyx", "xxx", "xyx",
'x', new ItemStack(Blocks.wooden_slab, 1, i), 'y', Blocks.chest);
if (config.isBlockEnabled("fullDrawers4"))
GameRegistry.addRecipe(new ItemStack(ModBlocks.fullDrawers4, config.getBlockRecipeOutput("fullDrawers4"), i), "yxy", "xxx", "yxy",
'x', new ItemStack(Blocks.planks, 1, i), 'y', Blocks.chest);
if (config.isBlockEnabled("halfDrawers4"))
GameRegistry.addRecipe(new ItemStack(ModBlocks.halfDrawers4, config.getBlockRecipeOutput("halfDrawers4"), i), "yxy", "xxx", "yxy",
'x', new ItemStack(Blocks.wooden_slab, 1, i), 'y', Blocks.chest);
}
GameRegistry.addRecipe(new ItemStack(ModBlocks.compDrawers), "xxx", "zwz", "xyx",
'x', new ItemStack(Blocks.stone), 'y', Items.iron_ingot, 'z', new ItemStack(Blocks.piston), 'w', new ItemStack(ModBlocks.fullDrawers2, 1, OreDictionary.WILDCARD_VALUE));
if (config.isBlockEnabled("compDrawers"))
GameRegistry.addRecipe(new ItemStack(ModBlocks.compDrawers, config.getBlockRecipeOutput("compDrawers")), "xxx", "zwz", "xyx",
'x', new ItemStack(Blocks.stone), 'y', Items.iron_ingot, 'z', new ItemStack(Blocks.piston), 'w', new ItemStack(ModBlocks.fullDrawers2, 1, OreDictionary.WILDCARD_VALUE));
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', Items.stick, 'y', new ItemStack(ModBlocks.fullDrawers2, 1, OreDictionary.WILDCARD_VALUE));
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', Items.stick, 'y', new ItemStack(ModBlocks.halfDrawers2, 1, OreDictionary.WILDCARD_VALUE));
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', Items.stick, 'y', new ItemStack(ModBlocks.fullDrawers4, 1, OreDictionary.WILDCARD_VALUE));
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', Items.stick, 'y', new ItemStack(ModBlocks.halfDrawers4, 1, OreDictionary.WILDCARD_VALUE));
if (config.isBlockEnabled("fullDrawers2"))
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', Items.stick, 'y', new ItemStack(ModBlocks.fullDrawers2, 1, OreDictionary.WILDCARD_VALUE));
if (config.isBlockEnabled("halfDrawers2"))
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', Items.stick, 'y', new ItemStack(ModBlocks.halfDrawers2, 1, OreDictionary.WILDCARD_VALUE));
if (config.isBlockEnabled("fullDrawers4"))
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', Items.stick, 'y', new ItemStack(ModBlocks.fullDrawers4, 1, OreDictionary.WILDCARD_VALUE));
if (config.isBlockEnabled("halfDrawers4"))
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', Items.stick, 'y', new ItemStack(ModBlocks.halfDrawers4, 1, OreDictionary.WILDCARD_VALUE));
GameRegistry.addRecipe(new ItemStack(ModItems.upgrade, 1, 2), "xyx", "yzy", "xyx",
'x', Items.iron_ingot, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
GameRegistry.addRecipe(new ItemStack(ModItems.upgrade, 1, 3), "xyx", "yzy", "xyx",
'x', Items.gold_ingot, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
GameRegistry.addRecipe(new ItemStack(ModItems.upgrade, 1, 4), "xyx", "yzy", "xyx",
'x', Blocks.obsidian, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
GameRegistry.addRecipe(new ItemStack(ModItems.upgrade, 1, 5), "xyx", "yzy", "xyx",
'x', Items.diamond, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
GameRegistry.addRecipe(new ItemStack(ModItems.upgrade, 1, 6), "xyx", "yzy", "xyx",
'x', Items.emerald, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
if (config.cache.enableStorageUpgrades) {
GameRegistry.addRecipe(new ItemStack(ModItems.upgrade, 1, 2), "xyx", "yzy", "xyx",
'x', Items.iron_ingot, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
GameRegistry.addRecipe(new ItemStack(ModItems.upgrade, 1, 3), "xyx", "yzy", "xyx",
'x', Items.gold_ingot, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
GameRegistry.addRecipe(new ItemStack(ModItems.upgrade, 1, 4), "xyx", "yzy", "xyx",
'x', Blocks.obsidian, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
GameRegistry.addRecipe(new ItemStack(ModItems.upgrade, 1, 5), "xyx", "yzy", "xyx",
'x', Items.diamond, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
GameRegistry.addRecipe(new ItemStack(ModItems.upgrade, 1, 6), "xyx", "yzy", "xyx",
'x', Items.emerald, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
}
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeStatus, 1, 1), "xyx", "yzy", "xyx",
'x', Items.redstone, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeStatus, 1, 2), "wyw", "yzy", "xyx",
'w', new ItemStack(Blocks.redstone_torch), 'x', Items.redstone, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeStatus, 1, 3), "wyw", "yzy", "xyx",
'w', Items.comparator, 'x', Items.redstone, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
if (config.cache.enableIndicatorUpgrades) {
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeStatus, 1, 1), "xyx", "yzy", "xyx",
'x', Items.redstone, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeStatus, 1, 2), "wyw", "yzy", "xyx",
'w', new ItemStack(Blocks.redstone_torch), 'x', Items.redstone, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeStatus, 1, 3), "wyw", "yzy", "xyx",
'w', Items.comparator, 'x', Items.redstone, 'y', Items.stick, 'z', ModItems.upgradeTemplate);
}
}
}