Jump to content

Furnace with 2 input slots


c-ab-o-o-s-e

Recommended Posts

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!

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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;
    }
}

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.