Jump to content

Recommended Posts

Posted

I'm trying to move most of my MineTweaker scripts into a mod(mostly for the exercise), and that involves removing a number of recipes.

I've only tried to move one crafting recipe in so far, and the adding worked. I tried to remove the recipe that it's supposed to be replacing(the Thermal Foundation Silver Gear), but that didn't work.

I've tracked the problem down to load order: TF is loading after my mod.

My mod is set to load after TF in its @Mod annotation and to require TF in the mcmod.info file, yet it still does postInit after TF. Because TF adds its recipes during its postInit, mine needs to happen after TFs. How can I make this happen?

My entire source code can be found here: https://github.com/TheTrueForce/MCLTweaks

The problem code is here: https://github.com/TheTrueForce/MCLTweaks/blob/master/src/java/com/trueForce/mclTweaks/Crafting.java#L28

Also, the code I'm using to remove the recipe(the removeMCrecipe() method) was designed for MC 1.3.2. Is it still valid?

EDIT: I'm stumped on how to remove/replace a Mekanism Shaped crafting recipe. Does anyone know how to do this?

 

Posted

In other words, have you tried adding your recipes during init and removing others during post-init?

 

Also, there are more, lesser-known, FML stages even after post-init. Just in case some mod injected its recipes during post-init, you could still trump them.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

Also, the code I'm using to remove the recipe(the removeMCrecipe() method) was designed for MC 1.3.2. Is it still valid?

 

EDIT: I'm stumped on how to remove/replace a Mekanism Shaped crafting recipe. Does anyone know how to do this?

 

IRecipe

provides the

getRecipeOutput

method, there's no need to check for specific implementations of it like you are now. This will allow any recipe type to be removed.

 

You can add a

ShapedRecipe

/

ShapedOreRecipe

as a replacement for a

MekanismRecipe

; but it won't have the ability to check for specific gas/energy values, item tiers or factory types and it won't transfer energy/gas from the input items to the output item. If you want this functionality, add Mekanism as a dependency and add a

MekanismRecipe

instead of a standard shaped recipe.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Jabelar:

I am calling my recipe delete code in postInit already, and I've used @Mod to specify that I want my mod to load after TF and CoFH Core. I also have an mcmod.info file, which I suspect may be overriding my @Mod annotation as regards load order.

I am adding my own recipes during Init and removing/replacing recipes during postInit. I've followed BedrockMiner's tutorials and sent that to my CommonProxy.

JeffryFisher:

I have added my own recipes in Init, and tried to remove and replace recipes during postInit.

Your comment about further stages is interesting. What are they, and how can I use them? Same way as with the usual three?

Choonster:

Thanks for that info on IRecipe. I obtained that code from an old thread on this site, so I've reworked that method to incorporate that.

As for the MekanismRecipe thing, I'm trying to disable some of those recipes in order to replace them, because I couldn't do that with MineTweaker. Thinking of MekanismRecipes, the altered remover can remove them. It does help that Mekanism adds its recipes during init.

Also, I was reading a thread about recipe removal on MC 1.8, and they recommended using an Iterator instead of an index in a for loop. Should I try switching over? I've never used an Iterator before, but I'm willing to have a go.

 

Posted

Also, I was reading a thread about recipe removal on MC 1.8, and they recommended using an Iterator instead of an index in a for loop. Should I try switching over? I've never used an Iterator before, but I'm willing to have a go.

 

Yes, I'd recommend using a for-each loop when just iterating (which uses the

Iterator

under the hood) or explicitly using the

Iterator

when you need to remove elements while iterating.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

To see the other FML events you might handle, just jump to the definition of preInit, init and/or postInit event type that you're already using as the input parameter to each main handler (in Eclipse that's easy). You should find yourself in a place that defines those three and some others.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.