Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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!

  • 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.

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

  • 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?

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

 

  • 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.

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

  • 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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.