Let’s add a custom recipe type and ji integration to minecraft oh all right we found this back until everyone’s more and in this tutorial we’re adding a custom recipe type to our block entity and then also making it available in ji with some custom integration but first things first let’s What we’re going to do is actually we’re going to first of all update to the parchment mappings secondly we’re then going to add the ji dependency as well so we’re going to do all of that immediately right here and then we’re going to start with the recipe right so let’s start right here Let’s get the gradle right here so we’re going to get the id that’s going to be under luggage there you go and we also need to add the parchment over here in the settings gradle that’s actually very important as well we do need to do that as well letting start Gradle so let’s add this i believe afterwards right yes this has to be added afterwards that’s fine and then here are the parchment mappings themselves you can just take those those are 117 that’s not quite updated but we can’t change them but let’s just add them so instead of having the official Ones right here we’re going to have parchment and those are going to be let’s see 119. so let’s just do this there you go look at that that is uh highly og let’s go 1192 one that is the time and that should pretty much be it I’m pretty sure that’s going to be it so let’s load the gradle changes now this can take anywhere from a few seconds to like probably like two or three minutes or something like that i think how much it has to download uh so once again just stay patient let this Download and then once we’re done here let’s then continue along all right there we go one minute 38 seconds as i’ve said and also you know if any warnings come up you can completely ignore them as long as you get a build successful and no like errors or Any type of exception that’s thrown then that should be totally fine that is then the parchment mappings added and that’s gonna be great and now let’s also add ji over here so we want to copy those two repositories and that’s gonna go into the build.gradle file under repositories Right here let’s just add this so let’s add both of them i highly recommend doing that and then you can also go for the dependencies for forge gradle there you go so we want to just get this one and let’s just copy this over i’m gonna Go below minecraft and then we need to still supply a minecraft version as well as a ji version now let’s just see what those are right here so we can see these are the current ones you can add those to the gradle properties file now under the maven listing Basically go in here and take a look at what you want so let’s say 119 forge and then the current version is 11.20247. so what you can do is then you can just copy this over go to the derail properties file put this in here Right so this is going to be 0 2 this is going to be 11 1 no it was 11 2 i believe right 11 2 0 yeah 11 2 0 and then 2 4 7 two seven four no two four seven that should be the two versions that we need let’s try This out and see if it works so let’s just reload gradle once again and this will hopefully also work with all of the forged stuff you can see we have the forge the common api the normal api the forward api and then the forge runtime as well now it actually Only took nine seconds i believe because i’ve downloaded jei already before that is why this you know was so quick and we can basically check whether or not it’s there for example let’s just do what plug-in i believe it’s called i am a plug-in actually but that’s fine Let’s let’s do this there you go mess this api or ji api there you go so that does exist so now um ji has also been added to the project and we can now basically proceed to well adding the custom recipe type all right with that Out of the way let’s start so the tutorial package right click new package called recipe and so though we need two new classes the first one is the gem infusing station recipe and the other class is the mod recipes class let’s start with the german fusing station recipe and this is going to Implement the recipe interface from net minecraft world item crafting of type simple container in this case and then we’ll hover over this implement methods and would you look at this beauty everything perfectly mapped over here ah you’d just love to see it in this case what we’re actually going to do is we’re Going to start with the three different fields that i want to add so the fields i want to add is the id the output so this is going to be one particular item stack that we’re going to be outputting of course from this recipe and then the Recipe items those are going to be the items that you need to craft this a particular output with and what i’m just going to do is i’m just going to copy over the constructor as well now all of the code is as always available to you in the description we’ll get repository Individually just as well and we can see we’re basically just setting the you know resource location the item stack and the output so the output and the recipe items nothing too crazy over here everything should be fine first of all we’re going to ignore the mattress method for a moment we’re going to Actually tackle this at the very end and then we’re just going to do the rest here so this is the the output method or this should be output right the assemble method over here and we have craft and craft and dimensions we’re just going to do true the result item is output.copy No dot copy there you go the resource location is literally just the id the serializer and the type we can’t do at the moment because we actually need to add two new classes once again what some of this will be copied over but no worries at all the first static class is The type class and you can see it just implements the recipe type of gem infusing station recipe and it is a very very simple class right it just has an instance here and an id here make sure that this id right here we’re gonna this basically gonna be the id that we’re Also going to use in the serializer and it has to be well german fusing so keep that in mind that is actually very important and then under the type we can just say uh type dot instance and that would pretty much be this and now we want the serializer now i’m gonna copy The serializer over without the methods and then we’re gonna see like what the frigate’s going on because the serializer is actually quite complicated so you can see we also have an instance right here and a resource location id once again geminfusing it’s very important that this is going to be the Name of your type so when we look back at some other recipe for example this one right here is type minecraft crafting shaped and now ours is going to be type tutorial mod gem infusing very important that that is the case now let’s hover over this and implement the Three methods from json from network and to network and then let’s think about what those do and what they need basically right so overall the from json which should be fairly self-explanatory we’re basically making a you know recipe through a json file and i’m going to Copy over the contents and then try to explain the best i can so that is actually the serialized recipe instead of just calling it json and then the id here is actually the recipe id fair enough there you go so what does this do well we’re basically reading from a json File similar to looking like this right or probably rather looking like this right we’re reading the result over here so you can see the item stack output is we’re looking for a field or you know a json object that’s called output and then creating a stack from that json Object interestingly enough so that is that then we’re going to have a json area of ingredients that’s going to be the same thing as this one right here right the ingredients and we’re just setting the size to 1 and then also this we can actually delete this is that this Is the spoiler for the future we don’t actually want to add that yet precisely determines how many of those ingredients are expected or how many of those are going to be read in and then those are going to be read in via this and a new infusing station recipe is created if You have anything other than this so if your block entity looks different it has more inputs more outputs and all that i mean the only thing i can say is that number one with a little bit of java knowledge this should not be too crazy and understandable if you have any more Interest in this you can take a look at pretty much just json serialization because that’s all it is or in this case it’s just reading in a json file and you can also always take a look at the other recipe stuff i believe if we press ctrl H on the recipe serializer we can see that there are different serializers right here so for example what we uh shaped recipe right so we can actually see the from jason method over here for the shape recipe and i highly recommend checking this out the vanilla classes once again are all Available to you they can only help you further along and then we have the from network and the two network as well so let’s just copy those over as well and i will explain once i copied both of them over because they are actually quite interesting indeed but hopefully not too Crazy to understand we’re definitely going to change the names over here this is going to be the buff and this is going to be the buff as well i do kind of like the names over here and then of course as always all of this is of Course available to you or download as well in the description below get a repository individual just as well we can see the from network is basically just a method that sends well i mean the recipe from the network to the client i guess and then to the network is just Basically the other way around so this is very important that when you’re playing on the server and this is not correct then you might actually get a crash now what do what do i mean by not correct well let’s look at the two network right we’re writing something to The network and we’re writing this inside of this buffer so you can see the first thing we’re writing is an integer and if we look at the from network the first thing we’re reading from the buffer is also an integer this is extremely important this always has to Match writing something reading it right then writing x amount of ingredients to the network and then reading x amount of ingredients from the network and then at the end here we’re writing the result item the with via an item stack and then here we’re reading an item stack it’s Extremely important that the order and everything here is done because if there is a mismatch then it will actually fire an exception and that will then be result in a crash on the server basically so keep that in mind that if you’re using any type of buffer that Everything you write is always red and it’s also always read in the same order that is extremely important and then you should be totally fine once again if you have something more complicated than this i suggest pretty much just trying stuff out of you know and playing around with This it shouldn’t be too overly complicated at all at this point in time right and then we can also do the serializer so that’s just serializer dot instance there you go and that should pretty much be that now we should have everything done here except for the Mattress method and that is going to be a very interesting one indeed the first thing we want to do is we want to say if p level that is client-side and then just return false over here i am unsure why this is the case i just know that i have tried this out And apparently you know it is like the stuff is null if it isn’t um if it isn’t working i am unsure about this right so it’s like for whatever reason there’s sort of a mismatch so that is why i basically added this and then we should be fine Now when it comes to the mattress method we’re basically getting the following thing so we’re going to say recipe items dot get 0 right and we’re going to test this dot get 0 right and we’re going to test this against p container dot get item of Index one now what does that mean well basically the zeroth item is the first item inside of our recipe list this would be if we have an ingredients list this would be this item right here right and we’re comparing this item to whatever item inside of the Instead of the gui that we have with index one so this item right here and if those two match then we know we have a recipe that is valid and we basically the mesh method is true and then we can proceed and craft all of this craziness And or do all sorts of cool stuff if you have like i said multiple uh inputs for the non-list right if you have multiple ingredients over here if you have multiple slots that you want to compare you just have to change the mattress method this Is sort of the brain of the recipe and once again if it’s more complicated try to figure it out this is a good example here in this case and then also you can always take a look at the examples from vanilla highly recommend that as well there are some Mattress methods that are also be looked at and then also you always have github repositories of other mods in theory as well so if you go more complicated then you just have to try and figure this out by trial and error i highly recommend it right let’s then actually register this Recipe so in the mod recipes class of course absolutely this is going to be the public static final deferred register of type a recipe serializer of type question mark in this case and that is going to be called the serializers and that is going to be equal to deferred register.create Forge registries dot this is the recipe serializers and then passing in a tutorialmod.mod id and of course as always right when we have this we want to say public static void register method with an i event bus called eventbus and then passing in serialize or serializers.register passing in the Event bus right here and that should be pretty much that and we can call this down here immediately mod recipes dot register passing in the event bus over here and that should be pretty much what we need in this case and then what we want to continue to do Is we then want to also go here and actually register our things that’s going to be our public static final registry object of type recipe serializer of type gem infusing gem infusing station recipe this is the gem underscore infusing underscore c realizer equal to of course the serializer.register Gem underscore infusing and this is equal to geminfusingstationrecipe.serializer.instance and that should register our custom recipe serializer here as well and should be pretty much everything that we need in this case and this should actually add our custom recipe already now we can you know this would be serialized right now but it Wouldn’t do anything so for the sake of argument let’s actually just add the recipe over here i’m just going to copy this over because that’s a little bit easier so zircon from infusing and you can see it’s gem infusing there’s one ingredient here raw xericon and what we’re getting output is the normal Zerocoin or like the you know cut zircon or whatever basically or the infused zerocoin whatever you want to call it basically now this is totally fine and this would already work totally fine and we can actually just for the sake of argument right let’s just like add another recipe here Just so that we can like actually try this out in a moment let’s do like minecraft stick maybe and then from this we’re gonna get minecraft uh how about like diamond sure i mean that makes no sense then it wouldn’t be called wood it would be called diamond From infusing yeah just so that we have like one other example that we can basically take a look at as well let’s see the following so that should be that and now we actually need to just make sure that our block entity also works with the custom recipe as well all right So what do we need to do in the block entity well when we remember this when we had the recipe over here we’re pretty much just asking hey do we have a raw zircon in the first slot now this of course will no longer work because now We’re actually also having a recipe that if we put a stick into the first slot that is also recipe so how do we you know how do we do that well what we can do is we have all of this craziness over here let’s actually add the following Thing let’s actually add a level here as well so this is going to be level level um and then we can just say equal to entity.level what we’re going to do is we’re going to then get a well the recipe so this is going to be optional of type gem infusing station recipe Called recipe let’s just call the recipe that’s fine and we can say level dot get recipe manager recipe manager there you go get recipe or the following recipe type gem infusing station stationrecipe.type.instance passing in the inventory as well as other level that’s why we need the level And that’s why we also need the simple container inventory over here and what we can then ask is instead of saying hey do we have a gem in the first slot we can actually ask is the recipe dot is present and if it is present then we’re saying Hey can we output you know add a certain you know thing into the output and if that also is the case then the question is can we insert a particular item now we still have this zerocoin over here that’s of course not quite right what we actually want to check for is the Recipe.getresult item over here uh just making sure there you go and that should be fine as well that’s actually really awesome indeed and now the question is in the craft item what do we do well we actually also need the recipe so let’s just copy all of this over here and that Is going to be the p entity that’s totally fine let’s just change this over here and then we can say hey if we have the recipe here then here instead of making a new zerocon what we’re just going to do is we’re just going to say recipe.get.getresult item that get item Now please make sure that if we do it like this if you were to add a count over here to the output it would be ignored so but overall i i’m pretty sure you should be able to figure out like how to use the count over here either You can just you know replace this count and then just say hey recipe.get uh to get the result item that count plus the count or you know something like that i’m pretty sure like basically replace the one with the count i’m pretty sure you should be able to figure this out Fairly easily um overall but those should be the two places where we just need to change this and the rest luckily because the way that we’ve programmed all of this should just work totally fine so in theory if we go into the game we should now be able to well create the Zircon still so that should still work but also what should work is the diamond from infusing so if we put a stick in there when we should get a diamond out so i mean i would say let’s get into the game and see if it works all right Frances in minecraft so let’s see if the raw zircon still works and that is actually very promising let’s see if we get a zircon out of it and in fact we do that’s pretty good let’s actually put two in there just you know once again just sanity test everything that Everything works right you can see once it has in here this still works and it adds it into it that’s fine and now the question is if we add a stick will this work as well that is very promising already let’s see if this turns into a Diamond and there we freaking go so we’re basically now making sticks into diamonds now this is of course extremely broken and should not be a recipe in your actual mod this is of course for demonstration purposes only but this hopefully shows you how easy something like this can be to Well may basically now add recipes via json files for your own custom block entity and other questions right we have ji of course right here uh you know if we were to know oh how do i you know make a cut copper block over here well Right like this now how do i get a zircon well we can smelt it so our custom recipes are of course in there but you know our german fusing station does not work how can we fix that well actually let’s now add ji integration for our customer recipe type as well now For this we’ll need a new package in the tutorial package we’re just going to call this integration some people want to call it uh compat or something like that but that’s going to be fine this is going to be the two two new classes ji tutorial Mod plugin and then the second one is going to be the absolute insanity then it’s going to be called gem infusing station recipe category all right quite a long name but we’re going to be fine and we only need the ji plug-in over here a plug-in should be fairly All right so the first thing we’re going to need is we need to implement the i mod plugin over here from um mei uh from mesji over here implemented the get plugin uid method and that’s going to be fine if for whatever reason this does not work you Will have to rewind and actually add the ji dependency to your project over here so please know that if for whatever reason the interface is not available to you that’s the reason why we also want to add the add ji plug-in over here this is extremely important don’t forget this Otherwise it will not work now i’m we’ll cut just copy over a few things the first one is just the recipe type over here i will fix this in just a moment when we actually create the gem infusing recipe over here and this is going to be fine The plugin uid is just going to be a new resource location for tutorial mod the mod id and then i just call this ji plug-in that should usually be fine and that was going to be okay now we need to register some things over here So um i will just in this case pretty much just copy over the two methods that we’re going to need now we get one error that is fine because we’ve not actually created anything in the gem infusing station recipe over here the rest is pretty much boilerplate code in a lot of Ways right we’re just getting the recipe manager here we’re just getting all the different recipe like infusing recipes and then we’re just basically registering all of those for our recipe type so this is pretty much going to be boilerplate and basically what you can have if you have Multiple ones if you have other another type right then you just need those two the list of that particular recipe and then just with another type over here and that should be fine you can also then add the recipe category as well or the new type if you have multiple ones Should be fairly self-explanatory like none of this should be absolutely crazy to you and what might be crazy to you is going to be the recipe category that’s going to be pretty insane this because this implements the i recipe recipe category this one right here of type gem infusing station recipe absolutely let’s Hover over this implement methods you can see we have to implement quite a few methods here and once again the some of the actual fields will be copied over namely the background and the icon the uid over here and the texture as well now the texture is just the gui in this case The uid is just gem infusing should be fairly self-explanatory here and then for the constructor we just have a helper and we’re just setting the background to the texture itself as well as the icon to the an item stack which is our gem infusing station so this is The icon that you see at the top sort of as a tab when you are inside of jei when it comes to this the recipe type is just ji tutorial modplugin.infusion type the get title here once again we’re just going to return component gem infusing station over here the i Drawable background is going to be this that background crazily enough and the icon is just going to be the start icon so that is dealt with those methods and then the questions the set recipe method this is the very interesting one because this is where you build your recipe so What you do is you do builder dot add slot and this is going to add a slot now what is this type of slot well we have output catalyst input or render only in this case we actually want an input slot at position e6 and 15. now this you know These x and y values might be familiar to you because they are the same values as the slot with index one because that’s exactly where we want to render the input and what do we want to render well we want to render an ingredient and that ingredient is recipe dot get result item No actually not we actually want to get the um actually when i get ingredients that get the first item so the first ingredient is what we want to render right there right so of index 0 of course which would be the first ingredient and then we can pretty much Just copy this over and say output over here the output is at 60 though there you go and then this is actually going to be instead of the ingredient here we want to just get not the group but get the output uh get a result item sorry there You go get result item and that is not an ingredient that is an item stack item stack there you go so i highly recommend what you do when you have you know once again your own recipes and all sorts of other crazy thing crazy things here Just play around with this a little bit this is probably one of the best ideas to do once again right it is um it’s just going to be a thing that you will need to try out you just need to look at stuff i highly recommend also You can check out the github repository for my own mod where i also have some ji integration or of course github repositories of other mods and have ji integration the the set recipe methods there can sometimes really help you out to sort of understand what to add here And otherwise it’s just about trying stuff out and basically being open to experimentation but this is actually all that we need to do and now every single recipe of our gem infusing type is going to be added to the ji plugin no more rs present we have the added ji plugin Which is extremely important please don’t forget this and apart from that let’s just go into the game and see if it works all right francis in minecraft and in theory what i should be able to do is press the u keys so to see the uses for the raw Xerocon and well what is that the thing is not displaying here that’s very interesting maybe for you know if i press r on the zerocoin also not displaying well what you can then do if you have any type of error what you should do is you should take the gem Infusing right here this is usually the name and you should just search for it so you can press ctrl f and then search for gem infusing and ah would you look at that there already is some type of broken recipe found very interesting and that is in the set recipe over here so That is the get ingredients ah i believe i know what this is because the get ingredient method has not been overwritten by us so what we actually need to do is we need to get ingredients over here and we want to return our recipe items and that should then Work i don’t know why this is not you know overwritten per default basically because this is a method that is in here right get ingredients um yeah for whatever reason it just has a defaulted one oh because it’s a non-nautilus probably so you can’t just like leave it null well fair enough but That should now fix that as well so let’s just start again and this is needed then for your um for your ji compatibility and also one example where you can just search for something and then you should hopefully find an error that is usually the case or the usually The way to do it so let’s start again and see if it works all right in minecraft again and let’s see uses for raw zircon and that is a great gem infusing station we can see tutorial mode let’s just go and there we are both of those things are rendered correctly And we can basically see what this entails let’s also see if we can see the same thing for the diamond so let’s see uh press r and there we go we can make take sticks and make diamonds out of it and you can see even the recipe by what The recipe is right from what mod basically so that is pretty awesome indeed and that is also ji integration added to your custom block entity right and that concludes this tutorial right here i hope you found this useful and you’ll learn something new and i’ll see You all in the next tutorial so yeah Video Information
This video, titled ‘Minecraft 1.19.2 Forge Modding Tutorial | CUSTOM RECIPE TYPES & JEI | #23’, was uploaded by Modding by Kaupenjoe on 2022-08-25 13:59:48. It has garnered 12584 views and 153 likes. The duration of the video is 00:27:13 or 1633 seconds.
In this Minecraft Modding Tutorial, we are adding custom recipe types and JEI Integration to our custom block entity with Forge in Minecraft 1.19.2
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== CATCH ME LIVE ON TWITCH == ▶️ https://www.twitch.tv/kaupenjoe
== ASSETS & DOWNLOAD LINKS == GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Forge-Tutorial-1.19/tree/23-recipeTypeAndJEI Gist: https://url.kaupenjoe.net/yt403/gist
== TIMESTAMPS == N/A
== 25% OFF FOR GAMING SERVERS == ▶️ https://www.bisecthosting.com/Kaupenjoe
== TAKE A LOOK AT MY COURSES WITH COUPON CODES == ▶️ NEW Forge Modding with Minecraft 1.20.X: https://url.kaupenjoe.net/CourseForge120X ▶️ Learn Forge Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseForge118 * ▶️ Learn Fabric Modding with Minecraft 1.18: https://url.kaupenjoe.net/CourseFabric118 * ▶️ Complete and Roblox Lua Game Development: https://url.kaupenjoe.net/RobloxCoupon *
== SUPPORT ME ON PATREON == ▶️ https://www.patreon.com/Kaupenjoe
== SOCIALS == Discord: https://discord.com/invite/yqxykanpWf Personal Twitter: https://twitter.com/Kaupenjoe
Instagram: https://url.kaupenjoe.net/tutorials/instagram Facebook: https://url.kaupenjoe.net/tutorials/facebook Twitter: https://url.kaupenjoe.net/tutorials/twitter TikTok: https://url.kaupenjoe.net/tutorials/tiktok Written Tutorials: https://url.kaupenjoe.net/tutorials/blog
== LICENSE == Source Code is distributed under the MIT License. Additional Licenses for other assets can be seen below or in the accompanying CREDITS.txt on download.
== ADDITIONAL CREDITS == Outro Musik by Kevin MacLeod: “That’s a Wrap” Kevin MacLeod (incompetech.com) Licensed under Creative Commons: By Attribution 3.0 http://creativecommons.org/licenses/by/3.0
== AFFILIATE DISCLAIMER == * Some of the links and other products that appear in the video description are from companies which I will earn an affiliate commission or referral bonus from or are my own products. This means that if you click on one of the product links, I’ll receive a small commission or additional kickback without any additional cost for you. This helps support the channel and allows me to continue to make videos. Thank you for the support!
== HASHTAGS == #Minecraft #MinecraftModding #MinecraftTutorial #Kaupenjoe