Skip to content

Commit

Permalink
Use ore dictionary key to work around recipe combinatorics and easily…
Browse files Browse the repository at this point in the history
… support addon packs.
  • Loading branch information
jaquadro committed Jun 25, 2015
1 parent 6a62cee commit b1fcb1a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
13 changes: 13 additions & 0 deletions src/com/jaquadro/minecraft/storagedrawers/core/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
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
{
Expand Down Expand Up @@ -71,6 +73,17 @@ public void init () {

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) {
Expand Down
29 changes: 8 additions & 21 deletions src/com/jaquadro/minecraft/storagedrawers/core/ModRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,32 +60,19 @@ public void init () {
'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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
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
{
Expand All @@ -35,8 +37,10 @@ public Block createBlock (BlockConfiguration blockConfig, IPackDataResolver data

@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)
Expand Down

0 comments on commit b1fcb1a

Please sign in to comment.