Posted February 22, 201411 yr What would be the best way to make a furnace that requires 2 different items to be able to get the output?
February 22, 201411 yr First of all have a TileEntity and Container that hold all the needed slots (2 input, fuel and output). Then you should also have a custom smelting class in which you set your custom furnace's smeltings. You basically check if the input items match one of your smeltings and if they do, then smelt to output. It's relatively simple if you have some TileEntity knowledge and experience. I try my best, so apologies if I said something obviously stupid!
February 22, 201411 yr Hi I reckon I remember somebody asking a question in this forum about exactly the same thing a few months ago. Ah yeah... http://www.minecraftforge.net/forum/index.php/topic,8218.0.html Might be of some help to you.... -TGG
February 22, 201411 yr Author OK I understand all the checks. The thing I'm still fuzzy on is making the recipe list itself I wanted to make a method something like... addSmelting(ItemStack output, int input1, int input2){ } It would accept 2 ids and give back the itemstack of the item to be received.
February 22, 201411 yr Hi I'm not sure I understand your question? In your addSmelting function you just need to check the values of input1 and input2, and if they match your recipe, return the appropriate ItemStack -TGG
February 22, 201411 yr Author Maybe im just being an idiot or something and not understanding what your saying. Don't i have to make my own version of furnace recipes in order to handle 2 inputs?
February 22, 201411 yr Hi Well that depends on how flexible you want to be. If you've only got a few recipes you can just hard code it. Something like /** * Used to get the resulting ItemStack from two source ItemStacks */ public ItemStack getSmeltingResult(ItemStack item1, ItemStack item2) { if (item1 == null || item2 == null) { return null; } if ( (item1.isItemStackEqual(myRecipeInput1) && item2.isItemStackEqual(myRecipeInput2)) || (item1.isItemStackEqual(myRecipeInput2) && item2.isItemStackEqual(myRecipeInput1)) ) { return myRecipeOutput.copy(); } else { return null; } } Is that what you meant? -TGG
February 23, 201411 yr Author yea that should work perfectly. At the moment I only have a couple to do. In the future though how would I make it bit more flexible just in case if I want to expand plus I'd like to have the knowledge.
February 23, 201411 yr Hi The vanilla FurnaceRecipes is a pretty straightforward example of how you might do it. You would just need to modify the data structures and methods to have two inputs instead of just one. -TGG
February 23, 201411 yr Author Alright I been working on a recipe list. I just took bits out of the vanilla code and trying to modify it. I believe I got the list setup properly to accept two items but I'm unsure on how to return it properly in the getSmeltingResult() public class CarbonWeaverRecipes { private static final CarbonWeaverRecipes smeltingBase = new CarbonWeaverRecipes(); /** The list of smelting results. */ private Map smeltingList = new HashMap(); private Map experienceList = new HashMap(); private HashMap<List<Integer>, ItemStack> metaSmeltingList = new HashMap<List<Integer>, ItemStack>(); private HashMap<List<Integer>, Float> metaExperience = new HashMap<List<Integer>, Float>(); /** * Used to call methods addSmelting and getSmeltingResult. */ public static final CarbonWeaverRecipes smelting() { return smeltingBase; } private CarbonWeaverRecipes() { this.addSmeltingOxy(SuperNova.denseCoal.itemID, SuperNova.titaniumIngots.itemID, new ItemStack(SuperNova.carbonFuel)); } /** * Adds a smelting recipe. */ public void addSmeltingOxy(int par1, int par2, ItemStack par3ItemStack) { this.smeltingList.put(Integer.valueOf(par1), Integer.valueOf(par2)); } /** * Returns the smelting result of an item. * Deprecated in favor of a metadata sensitive version */ @Deprecated public ItemStack getSmeltingResult(int par1) { return (ItemStack)this.smeltingList.get(Integer.valueOf(par1)); } public Map getSmeltingList() { return this.smeltingList; } /** * Used to get the resulting ItemStack form a source ItemStack * @param item The Source ItemStack * @return The result ItemStack */ public ItemStack getSmeltingResult(ItemStack item) { if (item == null) { return null; } ItemStack ret = (ItemStack)metaSmeltingList.get(Arrays.asList(item.itemID, item.getItemDamage())); if (ret != null) { return ret; } return (ItemStack)smeltingList.get(Integer.valueOf(item.itemID)); } public Map<List<Integer>, ItemStack> getMetaSmeltingList() { return metaSmeltingList; } }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.