Use ore dictionary key to work around recipe combinatorics and easily support addon packs.

This commit is contained in:
Justin Aquadro committed 2015-06-25 00:37:32 -04:00
1 parent 6a62ceefc7
commit b1fcb1ab3e
3 files changed
+26 -22

No files matched your search

@@ -14,6 +14,8 @@ import com.jaquadro.minecraft.storagedrawers.item.ItemTrim;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class ModBlocks
{
@@ -71,6 +73,17 @@ public class ModBlocks
GameRegistry.registerTileEntityWithAlternatives(TileEntitySlave.class, getQualifiedName("tileControllerSlave"),
getQualifiedName(controllerSlave));
for (String key : new String[] { "drawerBasic" })
OreDictionary.registerOre(key, new ItemStack(fullDrawers1, 1, OreDictionary.WILDCARD_VALUE));
for (String key : new String[] { "drawerBasic" })
OreDictionary.registerOre(key, new ItemStack(fullDrawers2, 1, OreDictionary.WILDCARD_VALUE));
for (String key : new String[] { "drawerBasic" })
OreDictionary.registerOre(key, new ItemStack(fullDrawers4, 1, OreDictionary.WILDCARD_VALUE));
for (String key : new String[] { "drawerBasic" })
OreDictionary.registerOre(key, new ItemStack(halfDrawers2, 1, OreDictionary.WILDCARD_VALUE));
for (String key : new String[] { "drawerBasic" })
OreDictionary.registerOre(key, new ItemStack(halfDrawers4, 1, OreDictionary.WILDCARD_VALUE));
}
public static String getQualifiedName (String name) {
@@ -60,32 +60,19 @@ public class ModRecipes
'x', "stickWood", 'y', "plankWood"));
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 ShapedOreRecipe(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', "drawerBasic"));
if (config.isBlockEnabled("controller"))
GameRegistry.addRecipe(new ItemStack(ModBlocks.controller), "xxx", "yzy", "xwx",
'x', new ItemStack(Blocks.stone), 'y', Items.comparator, 'z', new ItemStack(ModBlocks.fullDrawers2, 1, OreDictionary.WILDCARD_VALUE), 'w', Items.diamond);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.controller), "xxx", "yzy", "xwx",
'x', new ItemStack(Blocks.stone), 'y', Items.comparator, 'z', "drawerBasic", 'w', Items.diamond));
if (config.isBlockEnabled("controllerSlave"))
GameRegistry.addRecipe(new ItemStack(ModBlocks.controllerSlave), "xxx", "yzy", "xwx",
'x', new ItemStack(Blocks.stone), 'y', Items.comparator, 'z', new ItemStack(ModBlocks.fullDrawers2, 1, OreDictionary.WILDCARD_VALUE), 'w', Items.gold_ingot);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.controllerSlave), "xxx", "yzy", "xwx",
'x', new ItemStack(Blocks.stone), 'y', Items.comparator, 'z', "drawerBasic", 'w', Items.gold_ingot));
if (config.isBlockEnabled("fulldrawers1"))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', "stickWood", 'y', new ItemStack(ModBlocks.fullDrawers1, 1, OreDictionary.WILDCARD_VALUE)));
if (config.isBlockEnabled("fulldrawers2"))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', "stickWood", 'y', new ItemStack(ModBlocks.fullDrawers2, 1, OreDictionary.WILDCARD_VALUE)));
if (config.isBlockEnabled("halfdrawers2"))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', "stickWood", 'y', new ItemStack(ModBlocks.halfDrawers2, 1, OreDictionary.WILDCARD_VALUE)));
if (config.isBlockEnabled("fulldrawers4"))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', "stickWood", 'y', new ItemStack(ModBlocks.fullDrawers4, 1, OreDictionary.WILDCARD_VALUE)));
if (config.isBlockEnabled("halfdrawers4"))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', "stickWood", 'y', new ItemStack(ModBlocks.halfDrawers4, 1, OreDictionary.WILDCARD_VALUE)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
'x', "stickWood", 'y', "drawerBasic"));
if (config.cache.enableStorageUpgrades) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgrade, 1, 2), "xyx", "yzy", "xyx",
@@ -14,6 +14,8 @@ import com.jaquadro.minecraft.storagedrawers.item.pack.ItemSortingDrawersPack;
import com.jaquadro.minecraft.storagedrawers.item.pack.ItemTrimPack;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class PackFactory implements IPackBlockFactory
{
@@ -35,8 +37,10 @@ public class PackFactory implements IPackBlockFactory
@Override
public void registerBlock (Block block, String name) {
if (block instanceof BlockDrawersPack)
if (block instanceof BlockDrawersPack) {
GameRegistry.registerBlock(block, ItemDrawersPack.class, name);
OreDictionary.registerOre("drawerBasic", new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE));
}
else if (block instanceof BlockSortingDrawersPack)
GameRegistry.registerBlock(block, ItemSortingDrawersPack.class, name);
else if (block instanceof BlockTrimPack)