From cde1db9de2cce9bf5acadee8d5318ed8d50e8639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Gris?= Date: Mon, 3 Feb 2020 19:34:15 +0100 Subject: [PATCH] new(integration): storagedrawers gtnh recipes Integrates StorageDrawers with gtnh recipes. Config change Deprecate script Remove Gregtech assembler recipes map spam Move wood variants of drawers to chisel Save on load and server join time --- build.gradle | 6 +- packs/BiomesOPlenty/build.gradle | 4 +- packs/Erebus/build.gradle | 4 +- packs/Forestry/build.gradle | 4 +- packs/Misc/build.gradle | 4 +- packs/Natura/build.gradle | 4 +- .../api/config/IIntegrationConfig.java | 2 + .../storagedrawers/config/ConfigManager.java | 17 +- .../minecraft/storagedrawers/core/Api.java | 1 + .../storagedrawers/core/ModRecipes.java | 62 +- .../storagedrawers/core/api/PackFactory.java | 46 +- .../storagedrawers/core/api/PackRecipes.java | 76 ++- .../integration/ChiselIntegrationModule.java | 105 ++++ .../integration/GTNHIntegrationModule.java | 29 + .../integration/IntegrationRegistry.java | 4 + .../integration/gtnh/ModRecipes.java | 539 ++++++++++++++++++ 16 files changed, 803 insertions(+), 104 deletions(-) create mode 100644 src/com/jaquadro/minecraft/storagedrawers/integration/ChiselIntegrationModule.java create mode 100644 src/com/jaquadro/minecraft/storagedrawers/integration/GTNHIntegrationModule.java create mode 100644 src/com/jaquadro/minecraft/storagedrawers/integration/gtnh/ModRecipes.java diff --git a/build.gradle b/build.gradle index a894e5e..3756a56 100644 --- a/build.gradle +++ b/build.gradle @@ -24,13 +24,13 @@ apply plugin: 'forge' sourceCompatibility = 1.8 targetCompatibility = 1.8 -version = "1.7.10-1.10.9" +version = "1.7.10-1.11.0-gtnh" group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "StorageDrawers" minecraft { version = "1.7.10-10.13.4.1614-1.7.10" - assetDir = "runtime/assets" + runDir = "runtime" replace '@VERSION@', project.version } @@ -90,7 +90,7 @@ dependencies { compile "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev" compile "codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev" - compile files("libs/appliedenergistics2-rv2-beta-33-dev.jar") + compile files("libs/appliedenergistics2-rv3-beta-6-dev.jar") compile name: 'MineTweaker3', version: "Dev-1.7.10-3.0.10B", ext: 'jar' diff --git a/packs/BiomesOPlenty/build.gradle b/packs/BiomesOPlenty/build.gradle index 301ec34..23e69b9 100644 --- a/packs/BiomesOPlenty/build.gradle +++ b/packs/BiomesOPlenty/build.gradle @@ -23,7 +23,7 @@ archivesBaseName = "StorageDrawers-BiomesOPlenty" minecraft { version = "1.7.10-10.13.4.1614-1.7.10" - assetDir = "../../runtime/assets" + runDir = "../../runtime" replace '@VERSION@', project.version replace 'required-after:StorageDrawers', "required-after:StorageDrawers@[1.7.6,)" @@ -69,4 +69,4 @@ task deobfJar(type: Jar) { artifacts { archives deobfJar -} \ No newline at end of file +} diff --git a/packs/Erebus/build.gradle b/packs/Erebus/build.gradle index c0267f8..6e368bf 100644 --- a/packs/Erebus/build.gradle +++ b/packs/Erebus/build.gradle @@ -23,7 +23,7 @@ archivesBaseName = "StorageDrawers-Erebus" minecraft { version = "1.7.10-10.13.4.1614-1.7.10" - assetDir = "../../runtime/assets" + runDir = "../../runtime" replace '@VERSION@', project.version replace 'required-after:StorageDrawers', "required-after:StorageDrawers@[1.7.6,)" @@ -69,4 +69,4 @@ task deobfJar(type: Jar) { artifacts { archives deobfJar -} \ No newline at end of file +} diff --git a/packs/Forestry/build.gradle b/packs/Forestry/build.gradle index 33936c6..c6a14dc 100644 --- a/packs/Forestry/build.gradle +++ b/packs/Forestry/build.gradle @@ -23,7 +23,7 @@ archivesBaseName = "StorageDrawers-Forestry" minecraft { version = "1.7.10-10.13.4.1614-1.7.10" - assetDir = "../../runtime/assets" + runDir = "../../runtime" replace '@VERSION@', project.version replace 'required-after:StorageDrawers', "required-after:StorageDrawers@[1.7.6,)" @@ -69,4 +69,4 @@ task deobfJar(type: Jar) { artifacts { archives deobfJar -} \ No newline at end of file +} diff --git a/packs/Misc/build.gradle b/packs/Misc/build.gradle index 37b2c6b..f99dc5d 100644 --- a/packs/Misc/build.gradle +++ b/packs/Misc/build.gradle @@ -23,7 +23,7 @@ archivesBaseName = "StorageDrawers-Misc" minecraft { version = "1.7.10-10.13.4.1614-1.7.10" - assetDir = "../../runtime/assets" + runDir = "../../runtime" replace '@VERSION@', project.version replace 'required-after:StorageDrawers', "required-after:StorageDrawers@[1.7.6,)" @@ -69,4 +69,4 @@ task deobfJar(type: Jar) { artifacts { archives deobfJar -} \ No newline at end of file +} diff --git a/packs/Natura/build.gradle b/packs/Natura/build.gradle index c111027..d641130 100644 --- a/packs/Natura/build.gradle +++ b/packs/Natura/build.gradle @@ -23,7 +23,7 @@ archivesBaseName = "StorageDrawers-Natura" minecraft { version = "1.7.10-10.13.4.1614-1.7.10" - assetDir = "../../runtime/assets" + runDir = "../../runtime" replace '@VERSION@', project.version replace 'required-after:StorageDrawers', "required-after:StorageDrawers@[1.7.6,)" @@ -69,4 +69,4 @@ task deobfJar(type: Jar) { artifacts { archives deobfJar -} \ No newline at end of file +} diff --git a/src/com/jaquadro/minecraft/storagedrawers/api/config/IIntegrationConfig.java b/src/com/jaquadro/minecraft/storagedrawers/api/config/IIntegrationConfig.java index 28d9f13..fe18130 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/api/config/IIntegrationConfig.java +++ b/src/com/jaquadro/minecraft/storagedrawers/api/config/IIntegrationConfig.java @@ -3,4 +3,6 @@ package com.jaquadro.minecraft.storagedrawers.api.config; public interface IIntegrationConfig { boolean isRefinedRelocationEnabled (); + boolean isChiselEnabled (); + boolean isGTNHEnabled (); } diff --git a/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java b/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java index be22169..7e93173 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java +++ b/src/com/jaquadro/minecraft/storagedrawers/config/ConfigManager.java @@ -53,7 +53,7 @@ public class ConfigManager } } - public class ConfigCache { + public static class ConfigCache { public boolean enableIndicatorUpgrades; public boolean enableStorageUpgrades; public boolean enableLockUpgrades; @@ -77,6 +77,8 @@ public class ConfigManager public boolean enableRefinedRelocationIntegration; public boolean enableThermalExpansionIntegration; public boolean enableThermalFoundationIntegration; + public boolean enableChiselIntegration; + public boolean enableGTNHIntegration; public boolean enableTape; public boolean enableFallbackRecipes; public boolean enableFramedDrawers; @@ -160,6 +162,17 @@ public class ConfigManager public boolean isRefinedRelocationEnabled () { return cache.enableRefinedRelocationIntegration; } + + @Override + public boolean isChiselEnabled () { + return cache.enableChiselIntegration; + } + + @Override + public boolean isGTNHEnabled () { + return cache.enableGTNHIntegration; + } + } private class UserConfig implements IUserConfig { @@ -261,6 +274,8 @@ public class ConfigManager cache.enableRefinedRelocationIntegration = config.get(sectionIntegration.getQualifiedName(), "enableRefinedRelocation", true).setLanguageKey(LANG_PREFIX + "integration.enableRefinedRelocation").setRequiresMcRestart(true).getBoolean(); cache.enableThermalExpansionIntegration = config.get(sectionIntegration.getQualifiedName(), "enableThermalExpansion", true).setLanguageKey(LANG_PREFIX + "integration.enableThermalExpansion").setRequiresMcRestart(true).getBoolean(); cache.enableThermalFoundationIntegration = config.get(sectionIntegration.getQualifiedName(), "enableThermalFoundation", true).setLanguageKey(LANG_PREFIX + "integration.enableThermalFoundation").setRequiresMcRestart(true).getBoolean(); + cache.enableChiselIntegration = config.get(sectionIntegration.getQualifiedName(), "enableChisel", true).setLanguageKey(LANG_PREFIX + "integration.enableChisel").setRequiresMcRestart(true).getBoolean(); + cache.enableGTNHIntegration = config.get(sectionIntegration.getQualifiedName(), "enableGTNH", true).setLanguageKey(LANG_PREFIX + "integration.enableGTNH").setRequiresMcRestart(true).getBoolean(); config.get(sectionBlocksFullDrawers1x1.getQualifiedName(), "enabled", true).setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true); config.get(sectionBlocksFullDrawers1x1.getQualifiedName(), "baseStorage", 32).setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true); diff --git a/src/com/jaquadro/minecraft/storagedrawers/core/Api.java b/src/com/jaquadro/minecraft/storagedrawers/core/Api.java index 1f43002..309586f 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/core/Api.java +++ b/src/com/jaquadro/minecraft/storagedrawers/core/Api.java @@ -10,6 +10,7 @@ import com.jaquadro.minecraft.storagedrawers.api.registry.IRenderRegistry; import com.jaquadro.minecraft.storagedrawers.api.registry.IWailaRegistry; import com.jaquadro.minecraft.storagedrawers.core.api.PackFactory; import com.jaquadro.minecraft.storagedrawers.core.api.PackRecipes; +import com.jaquadro.minecraft.storagedrawers.integration.ChiselIntegrationModule; import com.jaquadro.minecraft.storagedrawers.integration.ThermalExpansion; public class Api implements IStorageDrawersApi diff --git a/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java b/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java index 3f2e0a1..ceb61dc 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java +++ b/src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java @@ -1,12 +1,10 @@ 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 com.jaquadro.minecraft.storagedrawers.core.recipe.TemplateRecipe; +import com.jaquadro.minecraft.storagedrawers.integration.ChiselIntegrationModule; +import com.jaquadro.minecraft.storagedrawers.integration.GTNHIntegrationModule; import cpw.mods.fml.common.registry.GameRegistry; -import minetweaker.mc1710.recipes.ShapedRecipeOre; import net.minecraft.block.BlockWood; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -16,39 +14,39 @@ import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.RecipeSorter; import net.minecraftforge.oredict.ShapedOreRecipe; -public class ModRecipes -{ - public void init () { +import static com.jaquadro.minecraft.storagedrawers.StorageDrawers.config; + +public class ModRecipes { + + public void init() { OreDictionary.registerOre("chestWood", new ItemStack(Blocks.chest)); // Remove when porting to 1.8 + if (GTNHIntegrationModule.isEnabled()) return; RecipeSorter.register("StorageDrawers:FallbackShapedOreRecipe", FallbackShapedOreRecipe.class, RecipeSorter.Category.SHAPED, "after:forge:shapedore"); - - ConfigManager config = StorageDrawers.config; - - for (int i = 0; i < BlockWood.field_150096_a.length; i++) { - if (config.isBlockEnabled("fulldrawers1")) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers1, config.getBlockRecipeOutput("fulldrawers1"), i), "xxx", " y ", "xxx", - 'x', new ItemStack(Blocks.planks, 1, i), 'y', "chestWood")); - if (config.isBlockEnabled("fulldrawers2")) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers2, config.getBlockRecipeOutput("fulldrawers2"), i), "xyx", "xxx", "xyx", - 'x', new ItemStack(Blocks.planks, 1, i), 'y', "chestWood")); - if (config.isBlockEnabled("halfdrawers2")) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers2, config.getBlockRecipeOutput("halfdrawers2"), i), "xyx", "xxx", "xyx", - 'x', new ItemStack(Blocks.wooden_slab, 1, i), 'y', "chestWood")); - if (config.isBlockEnabled("fulldrawers4")) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers4, config.getBlockRecipeOutput("fulldrawers4"), i), "yxy", "xxx", "yxy", - 'x', new ItemStack(Blocks.planks, 1, i), 'y', "chestWood")); - if (config.isBlockEnabled("halfdrawers4")) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers4, config.getBlockRecipeOutput("halfdrawers4"), i), "yxy", "xxx", "yxy", - 'x', new ItemStack(Blocks.wooden_slab, 1, i), 'y', "chestWood")); - if (config.isBlockEnabled("trim")) { - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.trim, config.getBlockRecipeOutput("trim"), i), "xyx", "yyy", "xyx", - 'x', "stickWood", 'y', new ItemStack(Blocks.planks, 1, i))); + if (!ChiselIntegrationModule.isEnabled()) { + for (int i = 0; i < BlockWood.field_150096_a.length; i++) { + if (config.isBlockEnabled("fulldrawers1")) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers1, config.getBlockRecipeOutput("fulldrawers1"), i), "xxx", " y ", "xxx", + 'x', new ItemStack(Blocks.planks, 1, i), 'y', "chestWood")); + if (config.isBlockEnabled("fulldrawers2")) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers2, config.getBlockRecipeOutput("fulldrawers2"), i), "xyx", "xxx", "xyx", + 'x', new ItemStack(Blocks.planks, 1, i), 'y', "chestWood")); + if (config.isBlockEnabled("halfdrawers2")) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers2, config.getBlockRecipeOutput("halfdrawers2"), i), "xyx", "xxx", "xyx", + 'x', new ItemStack(Blocks.wooden_slab, 1, i), 'y', "chestWood")); + if (config.isBlockEnabled("fulldrawers4")) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers4, config.getBlockRecipeOutput("fulldrawers4"), i), "yxy", "xxx", "yxy", + 'x', new ItemStack(Blocks.planks, 1, i), 'y', "chestWood")); + if (config.isBlockEnabled("halfdrawers4")) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers4, config.getBlockRecipeOutput("halfdrawers4"), i), "yxy", "xxx", "yxy", + 'x', new ItemStack(Blocks.wooden_slab, 1, i), 'y', "chestWood")); + if (config.isBlockEnabled("trim")) { + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.trim, config.getBlockRecipeOutput("trim"), i), "xyx", "yyy", "xyx", + 'x', "stickWood", 'y', new ItemStack(Blocks.planks, 1, i))); + } } } - - // Fallback recipes - if (config.cache.enableFallbackRecipes) { + if (config.cache.enableFallbackRecipes || ChiselIntegrationModule.isEnabled()) { if (config.isBlockEnabled("fulldrawers1")) GameRegistry.addRecipe(new FallbackShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers1, config.getBlockRecipeOutput("fulldrawers1"), 0), "xxx", " y ", "xxx", 'x', "plankWood", 'y', "chestWood")); diff --git a/src/com/jaquadro/minecraft/storagedrawers/core/api/PackFactory.java b/src/com/jaquadro/minecraft/storagedrawers/core/api/PackFactory.java index b6ba386..6fd1a2e 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/core/api/PackFactory.java +++ b/src/com/jaquadro/minecraft/storagedrawers/core/api/PackFactory.java @@ -5,12 +5,13 @@ import com.jaquadro.minecraft.storagedrawers.api.pack.BlockConfiguration; import com.jaquadro.minecraft.storagedrawers.api.pack.IExtendedDataResolver; import com.jaquadro.minecraft.storagedrawers.api.pack.IPackBlockFactory; import com.jaquadro.minecraft.storagedrawers.api.pack.IPackDataResolver; -import com.jaquadro.minecraft.storagedrawers.block.pack.BlockSortingTrimPack; -import com.jaquadro.minecraft.storagedrawers.config.ConfigManager; -import com.jaquadro.minecraft.storagedrawers.integration.IntegrationRegistry; import com.jaquadro.minecraft.storagedrawers.block.pack.BlockDrawersPack; import com.jaquadro.minecraft.storagedrawers.block.pack.BlockSortingDrawersPack; +import com.jaquadro.minecraft.storagedrawers.block.pack.BlockSortingTrimPack; import com.jaquadro.minecraft.storagedrawers.block.pack.BlockTrimPack; +import com.jaquadro.minecraft.storagedrawers.config.ConfigManager; +import com.jaquadro.minecraft.storagedrawers.integration.ChiselIntegrationModule; +import com.jaquadro.minecraft.storagedrawers.integration.IntegrationRegistry; import com.jaquadro.minecraft.storagedrawers.integration.notenoughitems.NEIStorageDrawersConfig; import com.jaquadro.minecraft.storagedrawers.integration.refinedrelocation.SortingBlockRegistry; import com.jaquadro.minecraft.storagedrawers.item.pack.ItemDrawersPack; @@ -23,10 +24,9 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -public class PackFactory implements IPackBlockFactory -{ +public class PackFactory implements IPackBlockFactory { @Override - public Block createBlock (BlockConfiguration blockConfig, IPackDataResolver dataResolver) { + public Block createBlock(BlockConfiguration blockConfig, IPackDataResolver dataResolver) { switch (blockConfig.getBlockType()) { case Drawers: return new BlockDrawersPack(dataResolver, blockConfig.getDrawerCount(), blockConfig.isHalfDepth()).setConfigName(getConfigName(blockConfig)); @@ -40,55 +40,43 @@ public class PackFactory implements IPackBlockFactory if (IntegrationRegistry.instance().isModLoaded("RefinedRelocation")) return new BlockSortingTrimPack(dataResolver); return null; + default: + return null; } - - return null; } - private static String getConfigName (BlockConfiguration blockConfig) { - if (blockConfig.getDrawerCount() == 1) - return "fullDrawers1"; - if (blockConfig.getDrawerCount() == 2 && !blockConfig.isHalfDepth()) - return "fullDrawers2"; - if (blockConfig.getDrawerCount() == 4 && !blockConfig.isHalfDepth()) - return "fullDrawers4"; - if (blockConfig.getDrawerCount() == 2 && blockConfig.isHalfDepth()) - return "halfDrawers2"; - if (blockConfig.getDrawerCount() == 4 && blockConfig.isHalfDepth()) - return "halfDrawers4"; - - return ""; + private static String getConfigName(BlockConfiguration blockConfig) { + return (blockConfig.isHalfDepth() ? "half" : "full") + "Drawer" + blockConfig.getDrawerCount(); } @Override - public void registerBlock (Block block, String name) { + public void registerBlock(Block block, String name) { if (block instanceof BlockSortingDrawersPack) { GameRegistry.registerBlock(block, ItemSortingDrawersPack.class, name); StorageDrawers.proxy.registerDrawer(block); - } - else if (block instanceof BlockDrawersPack) { + } else if (block instanceof BlockDrawersPack) { GameRegistry.registerBlock(block, ItemDrawersPack.class, name); OreDictionary.registerOre("drawerBasic", new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE)); StorageDrawers.proxy.registerDrawer(block); - } - else if (block instanceof BlockSortingTrimPack) + } else if (block instanceof BlockSortingTrimPack) GameRegistry.registerBlock(block, ItemSortingTrimPack.class, name); else if (block instanceof BlockTrimPack) GameRegistry.registerBlock(block, ItemTrimPack.class, name); + ChiselIntegrationModule.registerPackBlock(block); } @Override - public void bindSortingBlock (Block basicBlock, Block sortingBlock) { + public void bindSortingBlock(Block basicBlock, Block sortingBlock) { SortingBlockRegistry.register(basicBlock, sortingBlock); } @Override - public void hideBlock (String blockID) { + public void hideBlock(String blockID) { NEIStorageDrawersConfig.hideBlock(blockID); } @Override - public void registerResolver (IExtendedDataResolver resolver) { + public void registerResolver(IExtendedDataResolver resolver) { ConfigManager config = StorageDrawers.config; if (config.isBlockEnabled("fulldrawers1")) { StorageDrawers.blockRegistry.register(BlockConfiguration.BasicFull1, resolver); diff --git a/src/com/jaquadro/minecraft/storagedrawers/core/api/PackRecipes.java b/src/com/jaquadro/minecraft/storagedrawers/core/api/PackRecipes.java index 578c508..d2fc7d8 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/core/api/PackRecipes.java +++ b/src/com/jaquadro/minecraft/storagedrawers/core/api/PackRecipes.java @@ -1,5 +1,6 @@ package com.jaquadro.minecraft.storagedrawers.core.api; +import com.jaquadro.minecraft.storagedrawers.StorageDrawers; import com.jaquadro.minecraft.storagedrawers.api.IStorageDrawersApi; import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi; import com.jaquadro.minecraft.storagedrawers.api.config.IBlockConfig; @@ -12,9 +13,10 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.ShapedOreRecipe; -public class PackRecipes -{ - public static void registerStandardRecipes (IExtendedDataResolver resolver) { +import static com.jaquadro.minecraft.storagedrawers.StorageDrawers.*; + +public class PackRecipes { + public static void registerStandardRecipes(IExtendedDataResolver resolver) { IStorageDrawersApi api = StorageDrawersApi.instance(); if (api == null) return; @@ -39,39 +41,55 @@ public class PackRecipes if (!resolver.isValidMetaValue(i)) continue; - Block plank = resolver.getPlankBlock(i); - Block slab = resolver.getSlabBlock(i); - int plankMeta = resolver.getPlankMeta(i); - int slabMeta = resolver.getSlabMeta(i); + if (!config.cache.enableChiselIntegration && Loader.isModLoaded("chisel")) { + + Block plank = resolver.getPlankBlock(i); + Block slab = resolver.getSlabBlock(i); + int plankMeta = resolver.getPlankMeta(i); + int slabMeta = resolver.getSlabMeta(i); + + if (blockConfig.isBlockEnabled(nameFull1) && basicFull1 != null) { + if (plank != null) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(basicFull1, blockConfig.getBlockRecipeOutput(nameFull1), i), "xxx", " y ", "xxx", + 'x', new ItemStack(plank, 1, plankMeta), 'y', "chestWood")); + if (slab != null) { + if (StorageDrawers.config.cache.enableGTNHIntegration) { + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(basicFull1, blockConfig.getBlockRecipeOutput(nameFull1), i), + new String[]{ + "xxx", + "xyx", + "xxx"}, + 'x', new ItemStack(slab, 1, slabMeta), + 'y', "chestWood")); + } + } + } - if (plank != null) { - if (blockConfig.isBlockEnabled(nameFull1) && basicFull1 != null) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(basicFull1, blockConfig.getBlockRecipeOutput(nameFull1), i), "xxx", " y ", "xxx", - 'x', new ItemStack(plank, 1, plankMeta), 'y', "chestWood")); if (blockConfig.isBlockEnabled(nameFull2) && basicFull2 != null) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(basicFull2, blockConfig.getBlockRecipeOutput(nameFull2), i), "xyx", "xxx", "xyx", - 'x', new ItemStack(plank, 1, plankMeta), 'y', "chestWood")); + 'x', new ItemStack(plank, 1, plankMeta), 'y', "chestWood")); if (blockConfig.isBlockEnabled(nameFull4) && basicFull4 != null) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(basicFull4, blockConfig.getBlockRecipeOutput(nameFull4), i), "yxy", "xxx", "yxy", - 'x', new ItemStack(plank, 1, plankMeta), 'y', "chestWood")); + 'x', new ItemStack(plank, 1, plankMeta), 'y', "chestWood")); if (blockConfig.isBlockEnabled(nameTrim) && basicTrim != null) { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(basicTrim, blockConfig.getBlockRecipeOutput(nameTrim), i), "xyx", "yyy", "xyx", - 'x', "stickWood", 'y', new ItemStack(plank, 1, plankMeta))); + 'x', "stickWood", 'y', new ItemStack(plank, 1, plankMeta))); } - } - if (slab != null) { - if (blockConfig.isBlockEnabled(nameHalf2) && basicHalf2 != null) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(basicHalf2, blockConfig.getBlockRecipeOutput(nameHalf2), i), "xyx", "xxx", "xyx", - 'x', new ItemStack(slab, 1, slabMeta), 'y', "chestWood")); - if (blockConfig.isBlockEnabled(nameHalf4) && basicHalf4 != null) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(basicHalf4, blockConfig.getBlockRecipeOutput(nameHalf4), i), "yxy", "xxx", "yxy", - 'x', new ItemStack(slab, 1, slabMeta), 'y', "chestWood")); + if (slab != null) { + if (blockConfig.isBlockEnabled(nameHalf2) && basicHalf2 != null) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(basicHalf2, blockConfig.getBlockRecipeOutput(nameHalf2), i), "xyx", "xxx", "xyx", + 'x', new ItemStack(slab, 1, slabMeta), 'y', "chestWood")); + if (blockConfig.isBlockEnabled(nameHalf4) && basicHalf4 != null) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(basicHalf4, blockConfig.getBlockRecipeOutput(nameHalf4), i), "yxy", "xxx", "yxy", + 'x', new ItemStack(slab, 1, slabMeta), 'y', "chestWood")); + } } } } - public static void registerSortingRecipes (IExtendedDataResolver resolver) { + + public static void registerSortingRecipes(IExtendedDataResolver resolver) { IStorageDrawersApi api = StorageDrawersApi.instance(); if (api == null) return; @@ -108,22 +126,22 @@ public class PackRecipes if (blockConfig.isBlockEnabled(nameFull1) && sortingFull1 != null && basicFull1 != null) GameRegistry.addRecipe(new ItemStack(sortingFull1, 1, i), "x x", " y ", "x x", - 'x', Items.gold_nugget, 'y', new ItemStack(basicFull1, 1, i)); + 'x', Items.gold_nugget, 'y', new ItemStack(basicFull1, 1, i)); if (blockConfig.isBlockEnabled(nameFull2) && sortingFull2 != null && basicFull2 != null) GameRegistry.addRecipe(new ItemStack(sortingFull2, 1, i), "x x", " y ", "x x", - 'x', Items.gold_nugget, 'y', new ItemStack(basicFull2, 1, i)); + 'x', Items.gold_nugget, 'y', new ItemStack(basicFull2, 1, i)); if (blockConfig.isBlockEnabled(nameFull4) && sortingFull4 != null && basicFull4 != null) GameRegistry.addRecipe(new ItemStack(sortingFull4, 1, i), "x x", " y ", "x x", - 'x', Items.gold_nugget, 'y', new ItemStack(basicFull4, 1, i)); + 'x', Items.gold_nugget, 'y', new ItemStack(basicFull4, 1, i)); if (blockConfig.isBlockEnabled(nameHalf2) && sortingHalf2 != null && basicHalf2 != null) GameRegistry.addRecipe(new ItemStack(sortingHalf2, 1, i), "x x", " y ", "x x", - 'x', Items.gold_nugget, 'y', new ItemStack(basicHalf2, 1, i)); + 'x', Items.gold_nugget, 'y', new ItemStack(basicHalf2, 1, i)); if (blockConfig.isBlockEnabled(nameHalf4) && sortingHalf4 != null && basicHalf4 != null) GameRegistry.addRecipe(new ItemStack(sortingHalf4, 1, i), "x x", " y ", "x x", - 'x', Items.gold_nugget, 'y', new ItemStack(basicHalf4, 1, i)); + 'x', Items.gold_nugget, 'y', new ItemStack(basicHalf4, 1, i)); if (blockConfig.isBlockEnabled(nameTrim) && sortingTrim != null && basicTrim != null) GameRegistry.addRecipe(new ItemStack(sortingTrim, 1, i), "x x", " y ", "x x", - 'x', Items.gold_nugget, 'y', new ItemStack(basicTrim, 1, i)); + 'x', Items.gold_nugget, 'y', new ItemStack(basicTrim, 1, i)); } } } diff --git a/src/com/jaquadro/minecraft/storagedrawers/integration/ChiselIntegrationModule.java b/src/com/jaquadro/minecraft/storagedrawers/integration/ChiselIntegrationModule.java new file mode 100644 index 0000000..4db8e97 --- /dev/null +++ b/src/com/jaquadro/minecraft/storagedrawers/integration/ChiselIntegrationModule.java @@ -0,0 +1,105 @@ +package com.jaquadro.minecraft.storagedrawers.integration; + +import com.jaquadro.minecraft.storagedrawers.StorageDrawers; +import com.jaquadro.minecraft.storagedrawers.api.pack.IPackDataResolver; +import com.jaquadro.minecraft.storagedrawers.block.pack.BlockDrawersPack; +import com.jaquadro.minecraft.storagedrawers.block.pack.BlockSortingDrawersPack; +import com.jaquadro.minecraft.storagedrawers.block.pack.BlockSortingTrimPack; +import com.jaquadro.minecraft.storagedrawers.block.pack.BlockTrimPack; +import com.jaquadro.minecraft.storagedrawers.config.ConfigManager; +import com.jaquadro.minecraft.storagedrawers.core.ModBlocks; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.event.FMLInterModComms; +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.block.Block; +import net.minecraft.block.BlockWood; + +public class ChiselIntegrationModule extends IntegrationModule { + + private static final String chiselModID = "chisel"; + private static final String addVariation = "variation:add"; + + private static final boolean chiselEnabled = (Loader.isModLoaded(chiselModID) && StorageDrawers.config.integrationConfig.isChiselEnabled()); + + public static boolean isEnabled() { + return chiselEnabled; + } + + public static void registerPackBlock(Block block) { + if (!chiselEnabled) return; + + final String blockGroupName; + final IPackDataResolver resolver; + + if (block instanceof BlockDrawersPack) { + resolver = ((BlockDrawersPack) block).getDataResolver(); + if (((BlockDrawersPack) block).halfDepth) { + blockGroupName = "basicHalf" + ((BlockDrawersPack) block).drawerCount; + } else { + blockGroupName = "basicFull" + ((BlockDrawersPack) block).drawerCount; + } + } else if (block instanceof BlockSortingDrawersPack) { + resolver = ((BlockSortingDrawersPack) block).getDataResolver(); + if (((BlockSortingDrawersPack) block).halfDepth) { + blockGroupName = "sortingHalf" + ((BlockSortingDrawersPack) block).drawerCount; + } else { + blockGroupName = "sortingFull" + ((BlockSortingDrawersPack) block).drawerCount; + } + } else { + blockGroupName = "trim"; + if (block instanceof BlockTrimPack) { + resolver = ((BlockTrimPack) block).getDataResolver(); + } else { + if (block instanceof BlockSortingTrimPack) { + resolver = ((BlockSortingTrimPack) block).getDataResolver(); + } else return; + } + } + + // If block is not enabled its resolver is null + if (resolver == null) return; + + for (int meta = 0; meta <= 16; meta++) { + if (!resolver.isValidMetaValue(meta)) continue; + + registerBlock(block, meta, blockGroupName); + } + } + + public static void registerBlock(final Block block, final int meta, final String blockGroupName) { + FMLInterModComms.sendMessage(chiselModID, addVariation, String.join("|", + "StorageDrawers_" + blockGroupName, + GameRegistry.findUniqueIdentifierFor(block).toString(), + Integer.toString(meta))); + } + + @Override + public String getModID() { + return chiselModID; + } + + @Override + public void init() throws Throwable { + final ConfigManager config = StorageDrawers.config; + + for (int meta = 0; meta < BlockWood.field_150096_a.length; meta++) { + if (config.isBlockEnabled("fulldrawers1")) + registerBlock(ModBlocks.fullDrawers1, meta, "basicFull1"); + if (config.isBlockEnabled("fulldrawers2")) + registerBlock(ModBlocks.fullDrawers2, meta, "basicFull2"); + if (config.isBlockEnabled("fulldrawers4")) + registerBlock(ModBlocks.fullDrawers4, meta, "basicFull4"); + if (config.isBlockEnabled("halfdrawers2")) + registerBlock(ModBlocks.halfDrawers2, meta, "basicHalf2"); + if (config.isBlockEnabled("halfdrawers4")) + registerBlock(ModBlocks.halfDrawers4, meta, "basicHalf4"); + if (config.isBlockEnabled("trim")) + registerBlock(ModBlocks.trim, meta, "trim"); + } + } + + @Override + public void postInit() { + /* nothing */ + } +} diff --git a/src/com/jaquadro/minecraft/storagedrawers/integration/GTNHIntegrationModule.java b/src/com/jaquadro/minecraft/storagedrawers/integration/GTNHIntegrationModule.java new file mode 100644 index 0000000..1fa78b1 --- /dev/null +++ b/src/com/jaquadro/minecraft/storagedrawers/integration/GTNHIntegrationModule.java @@ -0,0 +1,29 @@ +package com.jaquadro.minecraft.storagedrawers.integration; + +import com.jaquadro.minecraft.storagedrawers.StorageDrawers; +import com.jaquadro.minecraft.storagedrawers.integration.gtnh.ModRecipes; +import cpw.mods.fml.common.Loader; + +public class GTNHIntegrationModule extends IntegrationModule { + + private static final boolean GTNHEnabled = (Loader.isModLoaded("gregtech") && StorageDrawers.config.integrationConfig.isGTNHEnabled()); + + public static boolean isEnabled() { + return GTNHEnabled; + } + + @Override + public String getModID() { + return null; + } + + @Override + public void init() throws Throwable { + ModRecipes.init(); + } + + @Override + public void postInit() { + + } +} diff --git a/src/com/jaquadro/minecraft/storagedrawers/integration/IntegrationRegistry.java b/src/com/jaquadro/minecraft/storagedrawers/integration/IntegrationRegistry.java index 000609c..045fff4 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/integration/IntegrationRegistry.java +++ b/src/com/jaquadro/minecraft/storagedrawers/integration/IntegrationRegistry.java @@ -32,6 +32,10 @@ public class IntegrationRegistry reg.add(new ThermalExpansion()); if (Loader.isModLoaded("ThermalFoundation") && StorageDrawers.config.cache.enableThermalFoundationIntegration) reg.add(new ThermalFoundation()); + if (ChiselIntegrationModule.isEnabled()) + reg.add(new ChiselIntegrationModule()); + if (GTNHIntegrationModule.isEnabled()) + reg.add(new GTNHIntegrationModule()); } private IntegrationRegistry () { diff --git a/src/com/jaquadro/minecraft/storagedrawers/integration/gtnh/ModRecipes.java b/src/com/jaquadro/minecraft/storagedrawers/integration/gtnh/ModRecipes.java new file mode 100644 index 0000000..ddfa533 --- /dev/null +++ b/src/com/jaquadro/minecraft/storagedrawers/integration/gtnh/ModRecipes.java @@ -0,0 +1,539 @@ +package com.jaquadro.minecraft.storagedrawers.integration.gtnh; + +import com.google.common.collect.ImmutableList; +import com.jaquadro.minecraft.storagedrawers.core.ModBlocks; +import com.jaquadro.minecraft.storagedrawers.core.ModItems; +import com.jaquadro.minecraft.storagedrawers.item.ItemDrawers; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; +import gregtech.api.util.GT_Utility; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; + +import static com.jaquadro.minecraft.storagedrawers.StorageDrawers.config; +import static gregtech.api.enums.GT_Values.NF; +import static gregtech.api.enums.GT_Values.RA; + +public class ModRecipes { + + private static final String MOD_ID_CB = "CarpentersBlocks"; + private static final String ORE_chestWood = "chestWood"; + private static final String ORE_drawerBasic = "drawerBasic"; + private static final String ORE_plateObsidian = "plateObsidian"; + private static final String ORE_plateRedstone = "plateRedstone"; + private static final String ORE_slabWood = "slabWood"; + private static final String ORE_stickWood = "stickWood"; + private static final String name_blockCarpentersBlock = "blockCarpentersBlock"; + + // Lists of Wildcard Meta slabWood ItemStacks suitable to optimize the number of Gregtech Assembler recipes registered + private static final ImmutableList slabWood8WList; + private static final ImmutableList slabWood7WList; + private static final ImmutableList slabWood5WList; + private static final ImmutableList slabWood4WList; + + // Ingredients for Drawers recipes + private static final ItemStack chest1 = new ItemStack(Blocks.chest, 1); + private static final ItemStack chest2 = new ItemStack(Blocks.chest, 2); + private static final ItemStack chest4 = new ItemStack(Blocks.chest, 4); + private static final ItemStack chest5 = new ItemStack(Blocks.chest, 5); + private static final ItemStack integratedCircuit1 = GT_Utility.getIntegratedCircuit(1); + private static final ItemStack integratedCircuit2 = GT_Utility.getIntegratedCircuit(2); + private static final ItemStack integratedCircuit4 = GT_Utility.getIntegratedCircuit(4); + private static final ItemStack integratedCircuit12 = GT_Utility.getIntegratedCircuit(12); + private static final ItemStack integratedCircuit14 = GT_Utility.getIntegratedCircuit(14); + + // Ingredients for Framed Drawers recipes + private static final ItemStack carpentersBlock8 = GameRegistry.findItemStack(MOD_ID_CB, name_blockCarpentersBlock, 8); + private static final ItemStack carpentersBlock7 = GameRegistry.findItemStack(MOD_ID_CB, name_blockCarpentersBlock, 7); + private static final ItemStack carpentersBlock5 = GameRegistry.findItemStack(MOD_ID_CB, name_blockCarpentersBlock, 5); + private static final ItemStack carpentersBlock4 = GameRegistry.findItemStack(MOD_ID_CB, name_blockCarpentersBlock, 4); + private static final ItemStack carpentersBlock1 = GameRegistry.findItemStack(MOD_ID_CB, name_blockCarpentersBlock, 1); + + // Ingredients for Trims + private static final ItemStack stick4 = new ItemStack(Items.stick, 4); + + // Ingredients for Controller + private static final ItemStack comparatorGate = makeItemStack("ProjRed|Integration:projectred.integration.gate", 26, 1, null); + + // Ingredients for Upgrades recipes + private static final ItemStack redAlloyWire = makeItemStack("ProjRed|Transmission:projectred.transmission.wire", 0, 1, null); + private static final ItemStack upgradeLock = new ItemStack(ModItems.upgradeLock); + private static final ItemStack piston = new ItemStack(Blocks.piston, 1); + private static final ItemStack upgradeTemplate = new ItemStack(ModItems.upgradeTemplate); + private static final ImmutableList drawerBasicW; + + static { + final ImmutableList.Builder slabWoodRegistryNameListBuilder = new ImmutableList.Builder<>(); + final ImmutableList.Builder slabWood8WListBuilder = new ImmutableList.Builder<>(); + final ImmutableList.Builder slabWood7WListBuilder = new ImmutableList.Builder<>(); + final ImmutableList.Builder slabWood5WListBuilder = new ImmutableList.Builder<>(); + final ImmutableList.Builder slabWood4WListBuilder = new ImmutableList.Builder<>(); + + // Build a list of unique slabWood Items's Registry Names ("MOD_ID:ItemName") + for (ItemStack slabWood : OreDictionary.getOres(ORE_slabWood)) { + slabWoodRegistryNameListBuilder.add(GameRegistry.findUniqueIdentifierFor(slabWood.getItem()).toString()); + } + + // Build lists of unique slabWood ItemStacks of different size with Wildcard Meta from the RegistryNames list above + for (String slabName : slabWoodRegistryNameListBuilder.build()) { + slabWood8WListBuilder.add(makeItemStack(slabName, OreDictionary.WILDCARD_VALUE, 8, null)); + slabWood7WListBuilder.add(makeItemStack(slabName, OreDictionary.WILDCARD_VALUE, 7, null)); + slabWood5WListBuilder.add(makeItemStack(slabName, OreDictionary.WILDCARD_VALUE, 5, null)); + slabWood4WListBuilder.add(makeItemStack(slabName, OreDictionary.WILDCARD_VALUE, 4, null)); + } + + slabWood8WList = slabWood8WListBuilder.build(); + slabWood7WList = slabWood7WListBuilder.build(); + slabWood5WList = slabWood5WListBuilder.build(); + slabWood4WList = slabWood4WListBuilder.build(); + + final ImmutableList.Builder drawerBasic1RegistryNameListBuilder = new ImmutableList.Builder<>(); + final ImmutableList.Builder drawerBasicRefs = new ImmutableList.Builder<>(); + + // Build a list of unique drawerBasic Items's Registry Names ("MOD_ID:ItemName") + for (ItemStack drawerBasicStack : OreDictionary.getOres(ORE_drawerBasic)) { + UniqueIdentifier drawerID = GameRegistry.findUniqueIdentifierFor(drawerBasicStack.getItem()); + // Keeps only fullDrawer1 to limit the amount of distinct items + if (drawerID.name.matches("fullDrawers1.*")) + drawerBasicRefs.add(drawerID.toString()); + } + + // Build the list of unique drawerBasic ItemStacks with Wildcard Meta from the RegistryNames list above + for (String drawerName : drawerBasicRefs.build()) { + final ItemStack drawerStack = makeItemStack(drawerName, OreDictionary.WILDCARD_VALUE, 1, null); + // Be sure to only keep the ItemDrawers and not some other mod's drawerBasic1 + if (drawerStack.getItem() instanceof ItemDrawers) { + drawerBasic1RegistryNameListBuilder.add(drawerStack); + } + } + + drawerBasicW = drawerBasic1RegistryNameListBuilder.build(); + } + + private ModRecipes() { + throw new IllegalStateException("Utility class"); + } + + public static void init() { + + // Drawer Recipes + + // Drawer Full + fullDrawers1Recipes(); // Drawer Full 1x1 + fullDrawers2Recipes(); // Drawer Full 1x2 + fullDrawers4Recipes(); // Drawer Full 2x2 + + // Drawer Half + halfDrawers2Recipes(); // Drawer Half 1x2 + halfDrawers4Recipes(); // Oak Drawer Half 2x2 + + // Trim Recipes + trimRecipes(); // Drawer trim + + // Drawer Machines Recipes + compDrawersRecipes(); // Compacting Drawer + controllerRecipes(); // Parent Controller recipe + controllerSlaveRecipes(); // Child Controller recipe + framingTableRecipes(); // Framing Table recipe + + // Upgrades recipes + upgradeTemplateRecipes(); // Upgrade Template + storageUpgradeRecipes(); // Iron, Gold, Obsidian, Diamond, Emerald Storage Upgrades + statusUpgradeRecipes(); // Status Upgrade I & II + redstoneUpgradeRecipes(); // Redstone, Max, Min Upgrades + voidUpgradeRecipes(); // Void Upgrade + lockUpgradeRecipes(); // Drawer key + shroudKeyUpgradeRecipes(); // Concealment Key + personalKeyUpgradeRecipes(); // Personal Key + + // Packing Tape + packingTapeRecipes(); // Packing Tape + } + + private static void fullDrawers1Recipes() { + if (!config.isBlockEnabled("fulldrawers1")) return; + + // Oak Drawer Full 1x1 + + final int recipeOutput = config.getBlockRecipeOutput("fulldrawers1"); + + // Oak Drawer Full 1x1 Workbench recipe + final ItemStack fullDrawer1 = new ItemStack(ModBlocks.fullDrawers1, recipeOutput, 0); + GameRegistry.addRecipe(new ShapedOreRecipe(fullDrawer1, "sss", "scs", "sss", 's', ORE_slabWood, 'c', ORE_chestWood)); + + // Oak Drawer Full 1x1 Gregtech Assembler recipes + for (ItemStack slabWood8W : slabWood8WList) + RA.addAssemblerRecipe(new ItemStack[]{slabWood8W, chest1, integratedCircuit1}, NF, fullDrawer1, 200, 16); + + // Framed Drawer Full 1x1 + + if (!config.cache.enableFramedDrawers) return; + + // Framed Drawer Full 1x1 Workbench recipe + final ItemStack fullCustom1 = new ItemStack(ModBlocks.fullCustom1, recipeOutput, 0); + GameRegistry.addRecipe(new ShapedOreRecipe(fullCustom1, "bbb", "bcb", "bbb", 'b', carpentersBlock1, 'c', ORE_chestWood)); + + // Framed Drawer Full 1x1 Gregtech Assembler recipe + RA.addAssemblerRecipe(new ItemStack[]{carpentersBlock8, chest1, integratedCircuit1}, NF, fullCustom1, 200, 16); + } + + private static void fullDrawers2Recipes() { + if (!config.isBlockEnabled("fulldrawers2")) return; + + // Oak Drawer Full 1x2 + + final int recipeOutput = config.getBlockRecipeOutput("fulldrawers2"); + + // Oak Drawer Full 1x2 Workbench recipe + final ItemStack fullDrawers2 = new ItemStack(ModBlocks.fullDrawers2, recipeOutput, 0); + GameRegistry.addRecipe(new ShapedOreRecipe(fullDrawers2, "scs", "sss", "scs", 's', ORE_slabWood, 'c', ORE_chestWood)); + + // Oak Drawer Full 1x2 Gregtech Assembler recipes + for (ItemStack slabWood7W : slabWood7WList) + RA.addAssemblerRecipe(new ItemStack[]{slabWood7W, chest2, integratedCircuit2}, NF, fullDrawers2, 200, 16); + + // Framed Drawer Full 1x2 + + if (!config.cache.enableFramedDrawers) return; + + // Framed Drawer Full 1x2 Workbench recipe + final ItemStack fullCustom2 = new ItemStack(ModBlocks.fullCustom2, recipeOutput, 0); + GameRegistry.addRecipe(new ShapedOreRecipe(fullCustom2, "bcb", "bbb", "bcb", 'b', carpentersBlock1, 'c', ORE_chestWood)); + + // Framed Drawer Full 1x2 Gregtech Assembler recipe + RA.addAssemblerRecipe(new ItemStack[]{carpentersBlock7, chest2, integratedCircuit2}, NF, fullCustom2, 200, 16); + } + + private static void fullDrawers4Recipes() { + if (!config.isBlockEnabled("fulldrawers4")) return; + + // Oak Drawer Full 2x2 + + final int recipeOutput = config.getBlockRecipeOutput("fulldrawers4"); + + // Oak Drawer Full 2x2 Workbench recipe + final ItemStack fullDrawers4 = new ItemStack(ModBlocks.fullDrawers4, recipeOutput, 0); + GameRegistry.addRecipe(new ShapedOreRecipe(fullDrawers4, "csc", "sss", "csc", 's', ORE_slabWood, 'c', ORE_chestWood)); + + // Oak Drawer Full 2x2 Gregtech Assembler recipes + for (ItemStack slabWood5W : slabWood5WList) + RA.addAssemblerRecipe(new ItemStack[]{slabWood5W, chest4, integratedCircuit4}, NF, fullDrawers4, 200, 16); + + // Framed Drawer Full 2x2 + + if (!config.cache.enableFramedDrawers) return; + + // Framed Drawer Full 2x2 Workbench recipe + final ItemStack fullCustom4 = new ItemStack(ModBlocks.fullCustom4, recipeOutput, 0); + GameRegistry.addRecipe(new ShapedOreRecipe(fullCustom4, "cbc", "bbb", "cbc", 'b', carpentersBlock1, 'c', ORE_chestWood)); + + // Framed Drawer Full 2x2 Gregtech Assembler recipe + RA.addAssemblerRecipe(new ItemStack[]{carpentersBlock5, chest4, integratedCircuit4}, NF, fullCustom4, 200, 16); + } + + private static void halfDrawers2Recipes() { + if (!config.isBlockEnabled("halfdrawers2")) return; + + // Oak Drawer Half 1x2 + + final int recipeOutput = config.getBlockRecipeOutput("halfdrawers2"); + + // Oak Drawer Half 1x2 Workbench recipe + final ItemStack halfDrawers2 = new ItemStack(ModBlocks.halfDrawers2, recipeOutput, 0); + GameRegistry.addRecipe(new ShapedOreRecipe(halfDrawers2, "sss", "csc", "sss", 's', ORE_slabWood, 'c', ORE_chestWood)); + + // Oak Drawer Half 1x2 Gregtech Assembler recipes + for (ItemStack slabWood7W : slabWood7WList) + RA.addAssemblerRecipe(new ItemStack[]{slabWood7W, chest2, integratedCircuit12}, NF, halfDrawers2, 200, 16); + + // Framed Drawer Half 1x2 + + if (!config.cache.enableFramedDrawers) return; + + // Framed Drawer Half 1x2 Workbench recipe + final ItemStack halfCustom2 = new ItemStack(ModBlocks.halfCustom2, recipeOutput, 0); + GameRegistry.addRecipe(new ShapedOreRecipe(halfCustom2, "bbb", "cbc", "bbb", 'b', carpentersBlock1, 'c', ORE_chestWood)); + + // Framed Drawer Half 1x2 Gregtech Assembler recipe + RA.addAssemblerRecipe(new ItemStack[]{carpentersBlock7, chest2, integratedCircuit12}, NF, halfCustom2, 200, 16); + } + + private static void halfDrawers4Recipes() { + if (!config.isBlockEnabled("halfdrawers4")) return; + + // Oak Drawer Half 2x2 + + final int recipeOutput = config.getBlockRecipeOutput("halfdrawers4"); + + // Oak Drawer Half 2x2 Workbench recipe + final ItemStack halfDrawers4 = new ItemStack(ModBlocks.halfDrawers4, recipeOutput, 0); + GameRegistry.addRecipe(new ShapedOreRecipe(halfDrawers4, "csc", "scs", "csc", 's', ORE_slabWood, 'c', ORE_chestWood)); + + for (ItemStack slabWood4W : slabWood4WList) + RA.addAssemblerRecipe(new ItemStack[]{slabWood4W, chest5, integratedCircuit14}, NF, halfDrawers4, 200, 16); + + // Framed Drawer Half 2x2 + + if (!config.cache.enableFramedDrawers) return; + + // Framed Drawer Half 2x2 Workbench recipe + final ItemStack halfCustom4 = new ItemStack(ModBlocks.halfCustom4, recipeOutput, 0); + GameRegistry.addRecipe(new ShapedOreRecipe(halfCustom4, "cbc", "bcb", "cbc", 'b', carpentersBlock1, 'c', ORE_chestWood)); + + // Framed Drawer Half 2x2 Gregtech Assembler recipe + RA.addAssemblerRecipe(new ItemStack[]{carpentersBlock4, chest5, integratedCircuit14}, NF, halfCustom4, 200, 16); + } + + private static void trimRecipes() { + if (!config.isBlockEnabled("trim")) return; + + // Oak Trim + + final int recipeOutput = config.getBlockRecipeOutput("trim"); + + // Oak Trim Workbench recipe + final ItemStack trim = new ItemStack(ModBlocks.trim, recipeOutput, 0); + GameRegistry.addRecipe(new ShapedOreRecipe(trim, "tst", "sss", "tst", 't', ORE_stickWood, 's', ORE_slabWood)); + + // Oak Trim Gregtech Assembler recipe + for (ItemStack slabWood5W : slabWood5WList) + RA.addAssemblerRecipe(new ItemStack[]{slabWood5W, stick4, integratedCircuit1}, NF, trim, 200, 16); + + // Framed Trim + + if (!config.cache.enableFramedDrawers) return; + + // Framed Trim Workbench recipe + final ItemStack trimCustom = new ItemStack(ModBlocks.trimCustom, recipeOutput, 0); + GameRegistry.addRecipe(new ShapedOreRecipe(trimCustom, "tbt", "bbb", "tbt", 'b', carpentersBlock1, 't', ORE_stickWood)); + + // Framed Trim Gregtech Assembler recipe + RA.addAssemblerRecipe(new ItemStack[]{carpentersBlock5, stick4, integratedCircuit1}, NF, trimCustom, 200, 16); + } + + private static void compDrawersRecipes() { + if (!config.isBlockEnabled("compdrawers")) return; + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.compDrawers, 1), + new String[]{ + "sss", + "pdp", + "oio"}, + 's', "stoneConcrete", + 'p', new ItemStack(Blocks.piston), + 'd', ORE_drawerBasic, + 'o', ORE_plateObsidian, + 'i', "plateIron")); + } + + private static void controllerRecipes() { + if (!config.isBlockEnabled("controller")) return; + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.controller), + new String[]{ + "scs", + "gbg", + "odo"}, + 's', "plateStainlessSteel", + 'c', "circuitGood", + 'g', comparatorGate, + 'b', ORE_drawerBasic, + 'o', ORE_plateObsidian, + 'd', "plateDiamond")); + } + + private static void controllerSlaveRecipes() { + if (!config.isBlockEnabled("controllerSlave")) return; + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.controllerSlave), "scs", "gbg", "oeo", + 's', "plateStainlessSteel", + 'c', "circuitGood", + 'g', comparatorGate, + 'b', ORE_drawerBasic, + 'o', ORE_plateObsidian, + 'e', "plateEnderEye")); + } + + private static void framingTableRecipes() { + if (!config.cache.enableFramedDrawers) return; + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.framingTable), "ttt", "fsf", "fdf", + 't', ModBlocks.trim, + 'f', "fenceWood", + 's', ORE_stickWood, + 'd', "craftingToolScrewdriver")); + } + + private static void upgradeTemplateRecipes() { + if (!(config.cache.enableIndicatorUpgrades + || config.cache.enableLockUpgrades + || config.cache.enablePersonalUpgrades + || config.cache.enableRedstoneUpgrades + || config.cache.enableShroudUpgrades + || config.cache.enableSortingUpgrades + || config.cache.enableStorageUpgrades + || config.cache.enableVoidUpgrades)) return; + for (ItemStack drawer : drawerBasicW) + RA.addAssemblerRecipe(new ItemStack[]{drawer, piston}, NF, upgradeTemplate, 1200, 16); + } + + private static void storageUpgradeRecipes() { + if (!config.cache.enableStorageUpgrades) return; + + // Upgarde Iron + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgrade, 1, 2), + new String[]{ + "pup", + "upu", + "psp"}, + 'p', "plateIron", + 's', "stickIron", + 'u', ModItems.upgradeTemplate)); + + // Upgarde Gold + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgrade, 1, 3), + new String[]{ + "pup", + "upu", + "psp"}, + 'p', "plateGold", + 's', "stickGold", + 'u', ModItems.upgradeTemplate)); + + // Upgarde Obsidian + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgrade, 1, 4), + new String[]{ + "pup", + "upu", + "psp"}, + 'p', ORE_plateObsidian, + 's', "stickObsidian", + 'u', ModItems.upgradeTemplate)); + + // Upgarde Diamond + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgrade, 1, 5), + new String[]{ + "pup", + "upu", + "psp"}, + 'p', "plateDiamond", + 's', "stickDiamond", + 'u', ModItems.upgradeTemplate)); + + // Upgarde Emerald + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgrade, 1, 6), + new String[]{ + "pup", + "upu", + "psp"}, + 'p', "plateEmerald", + 's', "stickEmerald", + 'u', ModItems.upgradeTemplate)); + } + + private static void statusUpgradeRecipes() { + if (!config.cache.enableIndicatorUpgrades) return; + + // Status Upgrade I recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeStatus, 1, 1), "twt", "wuw", "rwr", + 't', new ItemStack(Blocks.redstone_torch), + 'w', redAlloyWire, + 'u', ModItems.upgradeTemplate, + 'r', ORE_plateRedstone)); + + // Status Upgrade II recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeStatus, 1, 2), "gwg", "wuw", "rwr", + 'g', comparatorGate, + 'w', redAlloyWire, + 'u', ModItems.upgradeTemplate, + 'r', ORE_plateRedstone)); + } + + private static void redstoneUpgradeRecipes() { + if (!config.cache.enableRedstoneUpgrades) return; + + // Redstone Upgrade recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeRedstone, 1, 0), "rsr", "sus", "rwr", + 'r', ORE_plateRedstone, + 's', ORE_stickWood, + 'u', ModItems.upgradeTemplate, + 'w', redAlloyWire)); + + // Redstone Max Upgrade recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeRedstone, 1, 1), "rrr", "sus", "sws", + 'r', ORE_plateRedstone, + 's', ORE_stickWood, + 'u', ModItems.upgradeTemplate, + 'w', redAlloyWire)); + + // Redstone Min recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeRedstone, 1, 2), "sws", "sus", "rrr", + 'r', ORE_plateRedstone, + 's', ORE_stickWood, + 'u', ModItems.upgradeTemplate, + 'w', redAlloyWire)); + } + + private static void voidUpgradeRecipes() { + if (!config.cache.enableVoidUpgrades) return; + + // Upgrade Void recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeVoid), "sws", "ouo", "sws", + 's', ORE_stickWood, + 'w', redAlloyWire, + 'o', "plateDenseObsidian", + 'u', ModItems.upgradeTemplate)); + } + + private static void lockUpgradeRecipes() { + if (!config.cache.enableLockUpgrades) return; + + // Drawer Key recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeLock), " bs", "uso", "gt ", + 'b', "boltGold", + 's', "plateSteel", + 'u', ModItems.upgradeTemplate, + 'o', "stickGold", + 'g', "plateGold", + 't', "craftingToolSaw")); + } + + private static void shroudKeyUpgradeRecipes() { + if (!config.cache.enableShroudUpgrades) return; + + // Concealment Key + RA.addAssemblerRecipe(new ItemStack[]{upgradeLock, new ItemStack(Items.ender_eye)}, NF, new ItemStack(ModItems.shroudKey), 100, 30); + } + + private static void personalKeyUpgradeRecipes() { + if (!config.cache.enablePersonalUpgrades) return; + + // Storage Personal Key + RA.addAssemblerRecipe(new ItemStack[]{upgradeLock, new ItemStack(Items.name_tag)}, NF, new ItemStack(ModItems.personalKey), 100, 30); + } + + private static void packingTapeRecipes() { + if (!config.cache.enableTape) return; + + // Packing Tape + RA.addAssemblerRecipe(new ItemStack[]{ + new ItemStack(Items.paper), + GT_Utility.getIntegratedCircuit(1)}, + new FluidStack((FluidRegistry.getFluid("refinedglue") != null) ? + FluidRegistry.getFluid("refinedglue") : + FluidRegistry.getFluid("glue"), // Fallback glue + 144), + new ItemStack(ModItems.tape), + 200, 30); + } + + /* Same as cpw.mods.fml.common.registry.GameRegistry.makeItemStack + * But with working stackSize + */ + private static ItemStack makeItemStack(String itemName, int meta, int stackSize, String nbtString) { + final ItemStack rStack = GameRegistry.makeItemStack(itemName, meta, stackSize, nbtString); + rStack.stackSize = stackSize; + return rStack; + } +}