Jump to content

Recommended Posts

Posted

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!

Posted

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.

Posted

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

 

Posted

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.

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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