Hey guys it’s Thomas eerie techno vision and welcome to the next episode of our spigot plugin tutorial series in this episode we’re going to be covering custom recipes as well as furnace smelting recipes and we can just get right into it so you want to set these recipes wherever you create your either Your custom items or just load your items in general so in my case you know in the last episode we talked about the item manager and creating custom items so I’m gonna add a custom recipe to our our wand we made the stick of truth so in our method here our create wand Method I’m just gonna have it occur right below where the item is finalized here so after you’ve made your your custom item and again you can do this too you can add recipes to vanilla items as well and I’ll show that in a second but I’m gonna show this first so there’s Three different recipes types that you can you can use so first one is a shaped recipe and essentially a shaped recipe is the majority of minecraft crafting recipes it’s any recipe that has a defined shape that must be met in order to satisfy the recipes so for example Like a wooden pickaxe for example it has very set shape that you have to follow otherwise it won’t work so we’re gonna try that first so to make one of these you want to create an object shaped recipe object and we can just name this Sr4 shaped recipe I want this to equal a new shaped recipe and this is gonna take in two parameters so the first one is going to be a namespace key and they’re making just type name space key dot minecraft and instead of here you’re gonna pass in a string that is unique to Your recipe so this cannot be used anywhere else any other recipes so in my case this is going to be just one because it is a recipe for our wand and then of course a comma and the last parameter is the item so this item that You’re gonna pass in is an item stack this is going to be the result of the recipe so this is what you’re gonna get from the crafting recipe if you want to do your custom item here like we’re doing and that’s the reason we’re doing this custom items because we’re doing it Inside of the method here you would just pass in the item and that’s the the item stack that we made earlier that custom item stack if for whatever reason you were doing a vanilla recipe for a vanilla item essentially you could just pass in a new item stack And then this would be the result of your of your recipes so you could have like just material dot diamond for example and then one and that would be a vanilla item that you would get just one vanilla diamond as a result so that’s how you do vanilla results but we want This to be a recipe for our wand so you can type in item and add a semicolon at the end here so we have our recipe but it doesn’t actually do anything so we need to add a shape we can do that with SR ape and you want to pass in three Strings so I’ll talk about these in a second but let’s just set this up and a semicolon so each of these strings represents the different rows and a crafting table so this first string here is going to be the top row then we’ve got the middle row and then we’ve got The final the bottom row and these are each gonna have three slots in them like this and you can set these slots to any sort of key that you want and we’ll assign that key that character to a specific material so that you can have it be a functioning crafting recipes so And the empty spots would be blanks so I guess the best way to show this is just an example so I want my my wand here to be crafted with a piece of blaze powder in the top left corner a stick in the middle and then stick in the bottom Right corner so it kind of looks like a wand in the in the craft finger scheme so what we want to do is let’s have a greedy –nt here a key set for blaze powder which we’ll set later but I want it to be just the letter B capital B and Then because this is the top-left corner keep in mind that we’re setting to blaze powder here and then the remaining two slots in the top are gonna be empty so we just put two spaces there and that’s the top row just a blaze powder in the Top left corner and again this key can be whatever you’d like we’re gonna assign it later as a variable so nos through the middle so the middle is going to have a space on the left and then in the middle we want a stick so we’re gonna sign the letter ass to stick And then another space so this is making sure that in the middle here we have a stick in the middle and then the last row the bottom row of the crafting our crafting table rather we want two spaces and then another stick so hopefully this makes a little bit of sense another way You can visualize this is by bringing them down here like this this is a great way of visualizing it so you can see the top row of our card from cable the middle row and the bottom row and you can see it’s sort of like a diagonal Shape of two sticks and a blaze powder so yeah we can keep it like this if you’d like or you can do it on one line up to you now we need to actually set these up variables here to actual ingredients so we can do that with SR dot add ingredient dot Sorry set ingredient and we need to pass in the character so the first character is gonna be B capital B and keep in mind this is case sensitive so B and like B those are two separate characters alright so capital B comma and this is going to be equal to material dots and You can choose whatever your material type you want essentially for the what this is assigned to the character B so I want this to be blazed powder so dot blaze powder and there we go alright so now the character B is assigned to blaze powder and we can do The same thing for s so SR dot set ingredient character capital S and we want to set this to material dots blaze or not na blaze powder dogs stick there we go semicolon and there we go so that’s essentially how you set ingredients pretty simple now this Recipe is done it’s fully functional but we need to add it to the game so to do that we can just do bucket dog get server dot add recipe and we can add this recipe here to the game typing SR cuz that’s the variable we made the Object I mean and add a semicolon okay so now the the shape recipe is done and it’ll work in the game we’ll test this out later but I want to get through the other two first so next one we can talk about is a shapeless recipe and Again you don’t have to do these they’re all optional you can pick and choose whatever you want and it doesn’t have to be in your item manager but that’s where I want to put it just for like clarity clarity sake so anyway shapeless recipe this is the very similar to a shape Recipe except there’s no shape so you can just throw as many items as you know are set in this recipe into a crafting people in any order and it will make the item so an example of this kind of recipe would be like a flint and steel For example you can just put one Flint and one piece of iron ingot in the crafting recipe and it can be in any order any slot and it will still work so that’s what this is and we can make this with shapeless recipe shape cannot spell today a shapeless recipe shapeless Recipe let’s let’s name this SAR for shapeless recipe is equal to new shapeless recipe and this is gonna taking the same things as before so namespace key minecraft and again this has to be unique so you can’t just use wand again so I’m gonna put like wand underscore shapeless just so it’s unique To this for recipe and then again a comma after this and we need to pass in the item which is the again the the result of this recipe so I’m gonna type an item because I want it to be a recipe for our custom item here and I did this Wrong it has to be a parameter for the the shapeless recipe not the namespace key alright and item there we go okay so we have our shapeless recipe now since there’s no shape we don’t need to set a shape but we do need to set the Ingredients so you can do sar dots add ingredient and first thing you’re gonna type in is the amount of this ingredient so I want this recipe to be if you throw a 1 a 1 diamond and to blaze powder into a crafting table it’ll make the So first let’s do the the blaze powder so if we have to blaze powder so set the count to two and then we can set the material to blaze powder just like that super easy prick you do it again sar to add ingredients this time accounts of One and then material dot diamond okay let me call it the end all right so super simple it’s just saying throw to blaze powders in there and one diamond and this recipe will work so this is done all we need to do again is add it To the game with bucket dot get server dot add a recipe and again our recipe here is called SAR so we can take an SAR okay so these two recipes are done final one is a furnace recipe and this is essentially just a smelting or speed it’s like one thing goes into the Furnace and gets melted into another thing so maybe we can oh your furnace recipe alright so to make one of these just like you’d expect with everything else it’s just a recipe for this recipe object furnace recipe then we can just name this like smelt I guess is equal to New furnace recipe there’s gonna take in a few things a few more things than we’re used to so first name space key name space key dot Minecrafts I’m gonna get me a custom unique string here so it can’t be one it can’t be water square shapeless so let’s do want underscore Smelt there we go then we also need oh I put that too far out um we also need a the item the result of this crafting recipe so what the item you put in here will be the results of this smelting so again I want our custom item but again If you wanted a vanilla item you could just create a new item stack like I showcased before with a vanilla material alright and then next we need the actual material that is put into the furnace to be smelted so I want it so that when you Put in an emerald into the furnace it’ll be smelted into your this custom item so we can just do material emerald let’s bring this out here so it’s easier to see and so what this is doing is saying if you put an emerald in the furnace it will be smelted into this Item and yeah that’s pretty much it so now we also need to add the experience that you’ll get so you can get you know usually in minecraft you get experience for smelting certain ores you can set this to zero if you don’t want anything there I’m gonna set this to 1.0 F it Does have to be a float so yeah keep that in mind but you can set this to really whatever you want it’s just the experience that you’ll get when you finish the recipe and then finally we have the time in ticks that it takes to complete this recipe so in ticks one Second is 20 ticks so what you can do is set the amount of seconds you want this recipe to last I’m gonna have this be 10 seconds and you can just multiply it by 20 or if you want you could just multiply on your calculator and throw it In here but yeah I just remember the seconds you want the time in seconds times 20 so this recipe will take 10 seconds add a semicolon and this recipe is pretty much done all you have to do is again add it to the game with bucket get server address P and it’s named Spell alright and yeah so that’s pretty much it for recipes I know it’s like super simple but I just wanted to cover it really quickly and now let’s jump into the game and check them out all right so we’re inside of the game now and I have some of our materials in my Inventory here and let’s just try out a couple of the recipes so first one I want to try out is the shaped recipe and that was two sticks and a blaze powder and there we go we can see that it does craft the stick of truth and it is Shaped so you can’t just you know use these anywhere it does have to be in the other shape that we set but you can see that it is reversible so and that’s intentional so yeah we can now craft this stick of truth’ and it is the Custom item you can just make sure it does have that special event we sent where it explodes when you right click so yeah it’s all working great now let’s come back and try with this shape less recipe so that one was to blaze powder and one diamond just thrown Into the crafting table and you can see here that it does work and it is shapeless so we can just throw them wherever we like and it will work and that does mean that it should work in our our main inventory as well here so let’s just try That really quickly and there we go it does get our stick of truth alright and then the last one was a smelting recipe and we put one emerald into a furnace that’s what we set and it should take around ten seconds and give one experience point not super important but You can see that it is working and we should get our stick of truth’ and there we go so all the recipes are working greats and now you have some custom recipes for your items alright so that’s gonna do it for this tutorial thanks guys so much for Watching and remember that you can use this with vanilla items you don’t have to use just custom items so keep that in mind again you want to just change this item to whatever you want the outcome of your recipe to be and yeah I hope you Learned a lot and I will see you in the next episode You Video Information
This video, titled ‘Spigot: Custom Plugin Tutorial – Custom Recipes (#7)’, was uploaded by TechnoVision on 2020-07-16 01:47:25. It has garnered 21687 views and 475 likes. The duration of the video is 00:13:44 or 824 seconds.
Learn to code your own Minecraft Spigot plugin in this complete tutorial series! In this episode, we create some custom crafting and smelting recipes for our items.
— Important Links —
● GitHub: https://github.com/TechnoVisionDev/Spigot-Tutorial ● Discord: https://discord.gg/m5fjByfrKP
— Music —
● Chill Out Records – Minute Mix
— My Channel —
● Subscribe: http://tinyurl.com/zbc7mwy ● Instagram: https://www.instagram.com/tomm.peters ● Twitter: https://twitter.com/TechnoVisionTV
#spigot #plugin #tutorial