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

Posted

Hi all,

 

I have a very simple issue, but I haven't been able to find a simple answer to it.

All I want to do, is get the recipe of an item or block.

More specifically, I want to get the recipe of every item or block in the game (Including items added by mods).

I think NEI does this, and I do believe they have an API but I have yet to find proper documentation on it.

 

I've tried

 

@EventHandler
public void postInit(FMLPostInitializationEvent event) {

List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();

}

 

However this does not include many recipes for vanilla items such as tools. Am I running it too early?

 

Of course most recipes would be saved to the IRecipes,

but there are an exceptional case.

 

Tool Damage adding Recipes is the case. They are processed externally, not related with the IRecipes.

You can see the code in the net.minecraft.item.crafting.CraftingManager.

 

However, It is simple case so you would easily be able to deal with the case.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

  • Author

So every recipe except the ones you mentioned are stored in

 

CraftingManager.getInstance().getRecipeList();?

 

Right now I'm checking each IRecipe in that list if it is an instance of ShapedRecipes or ShapelessRecipes. Should I be checking for others? For example swords and other tools don't seem to be shaped or shapeless so what are they?

They are another type of recipe, so you have to check each of them.

It might be hard to deal with all of them, but it is necessary if you want to deal with every recipe.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

So, you have to deal with each of them.

It seems that there are no other ways to do that.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

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.