Jump to content

[1.12.2]Recipe that uses durabilty of a shovel when crafted


needle112

Recommended Posts

Hello, I'm new to coding and modding and I'm need your help.

I'm trying to make simple recipe: shovel + gravel = flint and i get it working, but I wonder how to make that the shovel uses its durability when crafted.

I know that there is a post (http://www.minecraftforge.net/forum/topic/60481-112-creating-recipes-with-multiple-results/) which is something that I need, but I just not understand what is written there, so I need a bit more precision, I'll appreciate it. Thank you!

Link to comment
Share on other sites

You need a custom IRecipe implementation (this will also require setting up a _factories.json file)

When you get to determineRemainingItems you leave the shovel (and damage it).

 

You can extend existing recipes and only override the single method.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

25 minutes ago, Draco18s said:

You need a custom IRecipe implementation (this will also require setting up a _factories.json file)

When you get to determineRemainingItems you leave the shovel (and damage it).

 

You can extend existing recipes and only override the single method.

So, how to actually implement custom IRecipe or at least look at the non custom one? I tried to google but find nothing. I checked that _factories.json and created somewhat similar, but what exactly should be in that class? Sorry for stupid questions

{
    "<type>": {
        "<name>": "<fully qualified classname for the specified type>"
    }
}
 
Link to comment
Share on other sites

57 minutes ago, needle112 said:

how to actually implement custom IRecipe

In Java. Its a class. 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

It should either:

a) implement IRecipe (and implementing it will tell you exactly what methods you need because you'll get red lines and the auto-fix will create stub methods you will need to implement (write code for))

b) extend an existing implementation of IRecipe (and you will need to override one or more of those methods to do what you want, as I mentioned previously)

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

11 hours ago, Draco18s said:

It should either:

a) implement IRecipe (and implementing it will tell you exactly what methods you need because you'll get red lines and the auto-fix will create stub methods you will need to implement (write code for))

b) extend an existing implementation of IRecipe (and you will need to override one or more of those methods to do what you want, as I mentioned previously) 

As I understand I should parse  recipe Json to get ingredients and outputs and somehow change it but I don't know needed syntax and can't google it

I have that but still don't know what to do, sorry :(

public class JustRecipeFactory implements IRecipeFactory {

    @Override
    public IRecipe parse(JsonContext context, JsonObject json) {
        // TODO Auto-generated method stub
        //what should go here? :(
        
        return null;
    }

}

Edited by needle112
Link to comment
Share on other sites

You need to parse the JSON.

See my example here:

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/api/recipes/RecipeToolMold.java#L248-L265

You're going to largely need to figure this out for yourself based on existing examples.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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.